Skip to content

Slottable: Improve displayName for easier debugging #3441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

chaance
Copy link
Member

@chaance chaance commented Apr 2, 2025

Something that has bugged me for a while is how Radix components add a lot of noise to the component tree view in React dev tools. This largely has to do with our use of the Slot component, which results in a view that is hard to grok and makes it more annoying to debug with so many components just named Slot.

CleanShot 2025-04-02 at 14 32 42

This PR introduces functions to create Slot and Slottable components with unique display names to make things a little less chaotic.

CleanShot 2025-04-02 at 14 32 25

In the future I'd like to propose eliminating internal usage of Slot for a functional approach to actually clean up the component tree as much as possible. This is an interim solution that avoids major refactoring.


SlotClone.displayName = 'SlotClone';
SlotClone.displayName = `${ownerName}.SlotClone`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@chaance chaance merged commit 7e198d4 into main Apr 3, 2025
3 checks passed
@chaance chaance deleted the chance/slot-improvements branch April 3, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants