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
[Flight] Instrument the Console in the RSC Environment and Replay Logs on the Client (#28384)
When developing in an RSC environment, you should be able to work in a
single environment as if it was a unified environment. With thrown
errors we already serialize them and then rethrow them on the client.
Since by default we log them via onError both in Flight and Fizz, you
can get the same log in the RSC runtime, the SSR runtime and on the
client.
With console logs made in SSR renders, you typically replay the same
code during hydration on the client. So for example warnings already
show up both in the SSR logs and on the client (although not guaranteed
to be the same). You could just spend your time in the client and you'd
be fine.
Previously, RSC logs would not be replayed because they don't hydrate.
So it's easy to miss warnings for example.
With this approach, we replay RSC logs both during SSR so they end up in
the SSR logs and on the client. That way you can just stay in the
browser window during normal development cycles. You shouldn't have to
care if your component is a server or client component when working on
logical things or iterating on a product.
With this change, you probably should mostly ignore the Flight log
stream and just look at the client or maybe the SSR one. Unless you're
digging into something specific. In particular if you just naively run
both Flight and Fizz in the same terminal you get duplicates. I like to
run out fixtures `yarn dev:region` and `yarn dev:global` in two separate
terminals.
Console logs may contain complex objects which can be inspected. Ideally
a DevTools inspector could reach into the RSC server and remotely
inspect objects using the remote inspection protocol. That way complex
objects can be loaded on demand as you expand into them. However, that
is a complex environment to set up and the server might not even be
alive anymore by the time you inspect the objects. Therefore, I do a
best effort to serialize the objects using the RSC protocol but limit
the depth that can be rendered.
This feature is only own in dev mode since it can be expensive.
In a follow up, I'll give the logs a special styling treatment to
clearly differentiate them from logs coming from the client. As well as
deal with stacks.
DiffTrain build for commit 9a5b6bd.
Copy file name to clipboardexpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -25707,7 +25707,7 @@ if (__DEV__) {
25707
25707
return root;
25708
25708
}
25709
25709
25710
-
var ReactVersion = "18.3.0-canary-41b3c31bc-20240221";
25710
+
var ReactVersion = "18.3.0-canary-9a5b6bd84-20240221";
Copy file name to clipboardexpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2
Original file line number
Diff line number
Diff line change
@@ -9171,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = {
9171
9171
throwError("TestRenderer does not support findFiberByHostInstance()");
9172
9172
},
9173
9173
bundleType: 0,
9174
-
version: "18.3.0-canary-41b3c31bc-20240221",
9174
+
version: "18.3.0-canary-9a5b6bd84-20240221",
9175
9175
rendererPackageName: "react-test-renderer"
9176
9176
};
9177
9177
varinternals$jscomp$inline_1195={
@@ -9202,7 +9202,7 @@ var internals$jscomp$inline_1195 = {
Copy file name to clipboardexpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2
Original file line number
Diff line number
Diff line change
@@ -9599,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = {
9599
9599
throwError("TestRenderer does not support findFiberByHostInstance()");
9600
9600
},
9601
9601
bundleType: 0,
9602
-
version: "18.3.0-canary-41b3c31bc-20240221",
9602
+
version: "18.3.0-canary-9a5b6bd84-20240221",
9603
9603
rendererPackageName: "react-test-renderer"
9604
9604
};
9605
9605
varinternals$jscomp$inline_1236={
@@ -9630,7 +9630,7 @@ var internals$jscomp$inline_1236 = {
0 commit comments