-
Notifications
You must be signed in to change notification settings - Fork 153
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(react-18): Add modern streaming implementation #14902
base: main
Are you sure you want to change the base?
Conversation
#1042 Bundle Size — 9.56MiB (+0.13%).112329a(current) vs ffe4f84 main#484(baseline) Important Bundle introduced 1 and removed 4 duplicate packages – View changed duplicate packages Warning Bundle introduced 3 new packages: web-vitals, @sentry-internal/browser-utils, stylis – View changed packages Bundle metrics
|
Current #1042 |
Baseline #484 |
|
---|---|---|
Initial JS | 3.69MiB (-6.57% ) |
3.95MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 87.82% |
2.04% |
Chunks | 142 (-0.7% ) |
143 |
Assets | 146 |
146 |
Modules | 5697 (+1.06% ) |
5637 |
Duplicate Modules | 501 (+10.11% ) |
455 |
Duplicate Code | 6.12% (+4.08% ) |
5.88% |
Packages | 282 (-3.09% ) |
291 |
Duplicate Packages | 39 (-7.14% ) |
42 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #1042 |
Baseline #484 |
|
---|---|---|
JS | 9.35MiB (+0.39% ) |
9.31MiB |
Other | 213.41KiB (-10.27% ) |
237.84KiB |
Bundle analysis report Branch streaming-3 Project dashboard
Generated by RelativeCI Documentation Report issue
e3011a4
to
966a012
Compare
|
||
// Abandon and switch to client rendering if enough time passes. | ||
streamTimeout = setTimeout(() => { | ||
abort() |
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.
@joeyAghion - Aside from better (general) error handling in React 18, hopefully this will solve any lingering issues we might encounter related to those datadog graphs with the React 17 implementation.
908eb4a
to
c190a0d
Compare
@@ -10,7 +10,7 @@ import { useRouter } from "System/Hooks/useRouter" | |||
import { FlashBanner_me$data } from "__generated__/FlashBanner_me.graphql" | |||
|
|||
interface FlashBannerProps { | |||
me?: FlashBanner_me$data | |||
me?: FlashBanner_me$data | null |
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.
(Just fixing this old annoying console warning)
f91d173
to
5559633
Compare
50ae199
to
a273915
Compare
@@ -159,6 +159,7 @@ export const NavBarLoggedInActionsQueryRenderer: React.FC<React.PropsWithChildre | |||
<FallbackErrorBoundary FallbackComponent={Placeholder}> | |||
<SystemQueryRenderer<NavBarLoggedInActionsQuery> | |||
environment={relayEnvironment} | |||
placeholder={user ? <Placeholder /> : undefined} |
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.
Fixed bug where nav flickers when checking whether logged in (after you've already logged in, on full page reload)
56befce
to
47ca53e
Compare
8951a05
to
90e0acb
Compare
The type of this PR is: Feat
Description
This one is quite exciting, because I wasn't sure if it was possible with styled-components, due to the core team waiting on the react team to release some new APIs for interleaving CSS within streams using the latest
renderToPipeableStream
. But to our luck, someone in the community just released an example app solving this problem last week and I tested it out here and things seem good ❇️ENV Var
hokusai staging env set ENABLE_SSR_STREAMING=true
hokusai production env set ENABLE_SSR_STREAMING=true
To test in dev, set ^ in
.env
file.For an overview on the powerful React 18 streaming features, see https://www.patterns.dev/react/react-selective-hydration/.
Log of data streaming in:
stream-data.mp4
There's still some more work to do to optimize for first render but with React 18 +
renderToPipeableStream
in place we can start implementing that. A couple of ideas:In terms of our system query renderers, some work remains to implement that - ie, we'd need to write the SSR query renderer data to some kind of dom data-bridge and then read that from the client (rehydrate), so that double fetches don't occur once the client remounts. Very doable! React team's forward-thinking engineering wins again.
cc @artsy/diamond-devs