-
Notifications
You must be signed in to change notification settings - Fork 47k
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
feat[devtools]: display Forget badge for the relevant components #27709
Conversation
403e638
to
e4136b8
Compare
function getDisplayNameForFiber(fiber: Fiber): string | null { | ||
function getDisplayNameForFiber( | ||
fiber: Fiber, | ||
shouldSkipForgetCheck: boolean = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to do this without adding a boolean argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably. Without recursion, but with some auxiliary variables. Why do you want to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is unnecessarily complex here with the recursion though? It's harder to reason about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is unnecessarily complex here with the recursion though?
I don't think so, but I can rewrite it, I don't have a strong opinion on it.
I am kinda surprised that this is the only thing we are discussing in this PR.
e4136b8
to
5e3be29
Compare
5e3be29
to
467275b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
### Breaking * refactor[devtools]: highlight an array of elements for native ([hoxyq](https://github.com/hoxyq) in [#27734](#27734)) ### Features * feat[devtools]: display Forget badge for the relevant components ([hoxyq](https://github.com/hoxyq) in [#27709](#27709)) ### Other * Added windows powershell syntax to build scripts ([PrathamLalwani](https://github.com/PrathamLalwani) in [#27692](#27692)) * refactor[react-devtools-shared]: minor parsing improvements and modifications ([hoxyq](https://github.com/hoxyq) in [#27661](#27661))
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
…ebook#27709) Adds `Forget` badge to all relevant components. Changes: - If component is compiled with Forget and using a built-in `useMemoCache` hook, it will have a `Forget` badge next to its display name in: - components tree - inspected element view - owners list - Such badges are indexable, so Forget components can be searched using search bar. Fixes: - Displaying the badges for owners list inside the inspected component view Implementation: - React DevTools backend is responsible for identifying if component is compiled with Forget, based on `fiber.updateQueue.memoCache`. It will wrap component's display name with `Forget(...)` prefix before passing operations to the frontend. On the frontend side, we will parse the display name and strip Forget prefix, marking the corresponding element by setting `compiledWithForget` field. Almost the same logic is currently used for HOC display names.
### Breaking * refactor[devtools]: highlight an array of elements for native ([hoxyq](https://github.com/hoxyq) in [facebook#27734](facebook#27734)) ### Features * feat[devtools]: display Forget badge for the relevant components ([hoxyq](https://github.com/hoxyq) in [facebook#27709](facebook#27709)) ### Other * Added windows powershell syntax to build scripts ([PrathamLalwani](https://github.com/PrathamLalwani) in [facebook#27692](facebook#27692)) * refactor[react-devtools-shared]: minor parsing improvements and modifications ([hoxyq](https://github.com/hoxyq) in [facebook#27661](facebook#27661))
) Adds `Forget` badge to all relevant components. Changes: - If component is compiled with Forget and using a built-in `useMemoCache` hook, it will have a `Forget` badge next to its display name in: - components tree - inspected element view - owners list - Such badges are indexable, so Forget components can be searched using search bar. Fixes: - Displaying the badges for owners list inside the inspected component view Implementation: - React DevTools backend is responsible for identifying if component is compiled with Forget, based on `fiber.updateQueue.memoCache`. It will wrap component's display name with `Forget(...)` prefix before passing operations to the frontend. On the frontend side, we will parse the display name and strip Forget prefix, marking the corresponding element by setting `compiledWithForget` field. Almost the same logic is currently used for HOC display names. DiffTrain build for commit 6c7b41d.
Adds
Forget
badge to all relevant components.Changes:
useMemoCache
hook, it will have aForget
badge next to its display name in:Fixes:
Implementation:
fiber.updateQueue.memoCache
. It will wrap component's display name withForget(...)
prefix before passing operations to the frontend. On the frontend side, we will parse the display name and strip Forget prefix, marking the corresponding element by settingcompiledWithForget
field. Almost the same logic is currently used for HOC display names.