-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
DevTools: Add support for use(Promise) #28277
Conversation
Comparing: 04b5992...931780c Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
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.
Oh wow, this is interesting. I wonder how this is going to work if component is not wrapped with Suspense
and usable
is a pending Promise at the moment of hooks inspection.
Planning to test it with browser extension later today / early tomorrow, will follow-up
f7d5353
to
931780c
Compare
In order to parse hooks tree of component X, DevTools is calling the render function of X: react/packages/react-debug-tools/src/ReactDebugHooks.js Lines 806 to 818 in 03d6f7c
In case if promise is in pending state at this stage, our patched We should probably also update this code and |
Better approach in #28297. Just going to cherry-pick the example from the devtools shell. |
Summary
Adds support for Devtools to display the fulfilled value of promises passed to
use
.The other cases would suspend so I don't think we need to handle them in devtools anyway.
How did you test this change?
Added new cases to shell under
FunctionWithUse
:Screen.Recording.2024-02-08.at.16.22.21.mov