You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Debug Tools] Introspect Promises in use() (#28297)
Alternative to #28295.
Instead of stashing all of the Usables eagerly, we can extract them by
replaying the render when we need them like we do with any other hook.
We already had an implementation of `use()` but it wasn't quite
complete.
These can also include further DebugInfo on them such as what Server
Component rendered the Promise or async debug info. This is nice just to
see which use() calls were made in the side-panel but it can also be
used to gather everything that might have suspended.
Together with #28286 we cover the
case when a Promise was used a child and if it was unwrapped with use().
Notably we don't cover a Promise that was thrown (although we do support
that in a Server Component which maybe we shouldn't). Throwing a Promise
isn't officially supported though and that use case should move to the
use() Hook.
The pattern of conditionally suspending based on cache also isn't really
supported with the use() pattern. You should always call use() if you
previously called use() with the same input. This also ensures that we
can track what might have suspended rather than what actually did.
One limitation of this strategy is that it's hard to find all the places
something might suspend in a tree without rerendering all the fibers
again. So we might need to still add something to the tree to indicate
which Fibers may have further debug info / thenables.
DiffTrain build for commit 7a32d71.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -25917,7 +25917,7 @@ if (__DEV__) {
25917
25917
return root;
25918
25918
}
25919
25919
25920
-
var ReactVersion = "18.3.0-canary-3f93ca1c8-20240212";
25920
+
var ReactVersion = "18.3.0-canary-7a32d718b-20240212";
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9167,7 +9167,7 @@ var devToolsConfig$jscomp$inline_1025 = {
9167
9167
throwError("TestRenderer does not support findFiberByHostInstance()");
9168
9168
},
9169
9169
bundleType: 0,
9170
-
version: "18.3.0-canary-3f93ca1c8-20240212",
9170
+
version: "18.3.0-canary-7a32d718b-20240212",
9171
9171
rendererPackageName: "react-test-renderer"
9172
9172
};
9173
9173
varinternals$jscomp$inline_1206={
@@ -9198,7 +9198,7 @@ var internals$jscomp$inline_1206 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9595,7 +9595,7 @@ var devToolsConfig$jscomp$inline_1067 = {
9595
9595
throwError("TestRenderer does not support findFiberByHostInstance()");
9596
9596
},
9597
9597
bundleType: 0,
9598
-
version: "18.3.0-canary-3f93ca1c8-20240212",
9598
+
version: "18.3.0-canary-7a32d718b-20240212",
9599
9599
rendererPackageName: "react-test-renderer"
9600
9600
};
9601
9601
varinternals$jscomp$inline_1247={
@@ -9626,7 +9626,7 @@ var internals$jscomp$inline_1247 = {
0 commit comments