Skip to content
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

[ServerContext] Flight support for ServerContext #23244

Merged
merged 87 commits into from
Mar 8, 2022

Conversation

salazarm
Copy link
Contributor

@salazarm salazarm commented Feb 7, 2022

Summary

This PR implements the Server Side support for ServerContext.
Checkout the jest tests to see how its used.

I need to figure out what warnings we need

How did you test this change?

Jest

@salazarm salazarm changed the title [ServerContext] Flight support for ServerContex [ServerContext] Flight support for ServerContext Feb 7, 2022
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Feb 7, 2022

const transport = ReactNoopFlightServer.render(<Foo />);
act(() => {
ServerContext._currentRenderer = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using jest.isolateModules so that the instances of ReactServerContext on the server/client were different but that ended up breaking the previous tests for some reason and didn't fix my issue. I can look into a better way to test this but for now is probably sufficient?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does surface an interesting scenario. Shopify currently runs Flight and Fizz in the same environment where they could interleave with each other. We don't really support it yet but there's a discussion about whether we should. Perhaps we should flip the isPrimaryRenderer bit for Flight so that if you end up in that situation you could at least make sure one renderer works with both. That might also fix your tests.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Feb 7, 2022

We won't want to do the convertModelToJSON thing because that creates a deep copy of the whole tree in memory which would be much slower. That doesn't happen with the built-in JSON.stringify since for anything that doesn't have a special override it just walks the existing object and emits it to a string.

For Relay we lived with this inefficiency where it converted the whole tree to a copy just because of legacy how this needs to fit into a JSON.stringify call for the GraphQL on the outside anyway but even that's inefficient.

This change moves that inefficiency into the non-Relay builds too.

I think if we wanted to fix this properly, we'd want to instead reimplement a custom serializer.

However, there's another way to solve this which is to always emit a placeholder as if you suspended immediately in the children of all Server Contexts. That has other downsides but only when you actually use Server Contexts instead of for the whole tree.

@salazarm
Copy link
Contributor Author

salazarm commented Feb 7, 2022

Gotcha. I had a version working without moving the recursive serialization. Alternatively we could do what JSON.stringify does in userspace by changing the object in place at the tail end of the recursion, no?

@sebmarkbage
Copy link
Collaborator

I think we shouldn't could this change to the recursion or implement a user space serializer in this first PR. We can do the hack where each provider creates a new task instead since that has to be solved in any scenario anyway. Then we can optimize later.

throw new Error('ServerContext in that name already exists');
}
const context: ReactServerContext<T> = {
$$typeof: REACT_CONTEXT_TYPE,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't fully thought through the implications but I suspect that this will need to have a different symbol so that you can distinguish them.

For one, how are you going to serialize this? There's no way to get to the name but if you add a field here, then it's a different type than the $$typeof represents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agreed. I forgot to mention in the summary but this is part 1. In the second part I'll add the hooks and add warnings to make everything work on the client. This was mostly to get all of the tests to pass with this PR. Btw, should this feature be behind a flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to set the Prototype to something else so that we can easily tell on the client. I think that would be sufficient for us?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it should be behind a flag. At least in the "isomorphic" and client parts but since that also affects the server (since it depends on isomorphic), you might as well flag it in Flight as well.

We don't use prototypes anywhere else. One reason is that this was faster in benchmarks but another reason is that it works if you have multiple copies of React. That's a little different in this case since the shared state doesn't work properly across multiple copies anyway.

@salazarm
Copy link
Contributor Author

salazarm commented Feb 8, 2022

Switched back to JSON.stringify + came up with new approach for popping context using a stack

@sizebot
Copy link

sizebot commented Feb 17, 2022

Comparing: 6edd55a...b6bbe30

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 131.21 kB 131.21 kB = 42.00 kB 42.00 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.14% 136.07 kB 136.26 kB +0.11% 43.42 kB 43.47 kB
facebook-www/ReactDOM-prod.classic.js +0.10% 435.17 kB 435.62 kB +0.17% 79.65 kB 79.79 kB
facebook-www/ReactDOM-prod.modern.js +0.07% 421.77 kB 422.05 kB +0.17% 77.64 kB 77.77 kB
facebook-www/ReactDOMForked-prod.classic.js +0.10% 435.17 kB 435.62 kB +0.17% 79.65 kB 79.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.52% 27.02 kB 59.31 kB +113.39% 7.20 kB 15.36 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.31% 27.02 kB 59.25 kB +113.14% 7.20 kB 15.34 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.31% 27.02 kB 59.25 kB +113.14% 7.20 kB 15.34 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +113.18% 28.53 kB 60.82 kB +105.89% 7.70 kB 15.85 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +112.98% 28.53 kB 60.76 kB +105.65% 7.70 kB 15.83 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +112.98% 28.53 kB 60.76 kB +105.65% 7.70 kB 15.83 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.22% 30.27 kB 63.94 kB +104.87% 7.84 kB 16.06 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.02% 30.27 kB 63.88 kB +104.62% 7.84 kB 16.04 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.02% 30.27 kB 63.88 kB +104.62% 7.84 kB 16.04 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +104.32% 7.68 kB 15.69 kB +93.26% 3.01 kB 5.83 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +103.74% 7.68 kB 15.64 kB +92.53% 3.01 kB 5.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +103.74% 7.68 kB 15.64 kB +92.53% 3.01 kB 5.80 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +102.08% 7.86 kB 15.87 kB +90.84% 3.12 kB 5.96 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +101.50% 7.86 kB 15.83 kB +90.00% 3.12 kB 5.93 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +101.50% 7.86 kB 15.83 kB +90.00% 3.12 kB 5.93 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.97% 8.07 kB 16.06 kB +86.50% 3.22 kB 6.00 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.45% 8.07 kB 16.02 kB +85.79% 3.22 kB 5.97 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.45% 8.07 kB 16.02 kB +85.79% 3.22 kB 5.97 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +96.65% 26.87 kB 52.85 kB +94.37% 6.92 kB 13.46 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +96.45% 26.87 kB 52.79 kB +94.09% 6.92 kB 13.44 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +68.41% 15.74 kB 26.50 kB +72.51% 4.08 kB 7.04 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +67.92% 15.74 kB 26.42 kB +71.70% 4.08 kB 7.00 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
oss-stable/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js +42.05% 27.00 kB 38.35 kB +39.60% 7.01 kB 9.78 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +32.77% 15.72 kB 20.87 kB +28.23% 4.06 kB 5.20 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
facebook-www/React-prod.modern.js +8.34% 17.05 kB 18.47 kB +6.27% 4.39 kB 4.66 kB
facebook-www/React-prod.classic.js +8.27% 17.20 kB 18.62 kB +6.20% 4.43 kB 4.71 kB
facebook-www/React-profiling.modern.js +8.05% 17.66 kB 19.08 kB +6.11% 4.51 kB 4.79 kB
facebook-www/React-profiling.classic.js +7.99% 17.81 kB 19.23 kB +6.05% 4.56 kB 4.84 kB
oss-experimental/react/cjs/react.production.min.js +7.76% 7.63 kB 8.22 kB +5.72% 2.92 kB 3.09 kB
oss-experimental/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-stable/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-stable/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-experimental/react/umd/react.profiling.min.js +5.00% 11.41 kB 11.98 kB +3.94% 4.47 kB 4.65 kB
oss-experimental/react/umd/react.production.min.js +5.00% 11.41 kB 11.98 kB +3.94% 4.47 kB 4.65 kB
oss-experimental/react/cjs/react.development.js +3.23% 89.15 kB 92.02 kB +3.11% 23.98 kB 24.72 kB
oss-experimental/react/umd/react.development.js +2.78% 111.55 kB 114.65 kB +2.83% 28.60 kB 29.41 kB
facebook-www/React-dev.modern.js +2.55% 113.52 kB 116.41 kB +2.68% 28.09 kB 28.85 kB
facebook-www/React-dev.classic.js +2.52% 114.54 kB 117.43 kB +2.68% 28.29 kB 29.04 kB
facebook-react-native/react-is/cjs/ReactIs-prod.js +2.44% 4.59 kB 4.70 kB +1.25% 1.12 kB 1.13 kB
facebook-react-native/react-is/cjs/ReactIs-profiling.js +2.44% 4.59 kB 4.70 kB +1.25% 1.12 kB 1.13 kB
facebook-www/ReactIs-prod.classic.js +2.25% 4.98 kB 5.09 kB +1.13% 1.24 kB 1.26 kB
facebook-www/ReactIs-prod.modern.js +2.25% 4.98 kB 5.09 kB +1.13% 1.24 kB 1.26 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.52% 27.02 kB 59.31 kB +113.39% 7.20 kB 15.36 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.31% 27.02 kB 59.25 kB +113.14% 7.20 kB 15.34 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +119.31% 27.02 kB 59.25 kB +113.14% 7.20 kB 15.34 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +113.18% 28.53 kB 60.82 kB +105.89% 7.70 kB 15.85 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +112.98% 28.53 kB 60.76 kB +105.65% 7.70 kB 15.83 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +112.98% 28.53 kB 60.76 kB +105.65% 7.70 kB 15.83 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.22% 30.27 kB 63.94 kB +104.87% 7.84 kB 16.06 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.02% 30.27 kB 63.88 kB +104.62% 7.84 kB 16.04 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +111.02% 30.27 kB 63.88 kB +104.62% 7.84 kB 16.04 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +104.32% 7.68 kB 15.69 kB +93.26% 3.01 kB 5.83 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +103.74% 7.68 kB 15.64 kB +92.53% 3.01 kB 5.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +103.74% 7.68 kB 15.64 kB +92.53% 3.01 kB 5.80 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +102.08% 7.86 kB 15.87 kB +90.84% 3.12 kB 5.96 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +101.50% 7.86 kB 15.83 kB +90.00% 3.12 kB 5.93 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +101.50% 7.86 kB 15.83 kB +90.00% 3.12 kB 5.93 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.97% 8.07 kB 16.06 kB +86.50% 3.22 kB 6.00 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.45% 8.07 kB 16.02 kB +85.79% 3.22 kB 5.97 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +98.45% 8.07 kB 16.02 kB +85.79% 3.22 kB 5.97 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +96.65% 26.87 kB 52.85 kB +94.37% 6.92 kB 13.46 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +96.45% 26.87 kB 52.79 kB +94.09% 6.92 kB 13.44 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +68.41% 15.74 kB 26.50 kB +72.51% 4.08 kB 7.04 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +67.92% 15.74 kB 26.42 kB +71.70% 4.08 kB 7.00 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
oss-stable/react-server/cjs/react-server-flight.development.js +44.19% 26.35 kB 37.99 kB +38.35% 7.01 kB 9.70 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js +42.05% 27.00 kB 38.35 kB +39.60% 7.01 kB 9.78 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +32.77% 15.72 kB 20.87 kB +28.23% 4.06 kB 5.20 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +27.88% 7.69 kB 9.84 kB +20.78% 3.06 kB 3.69 kB
facebook-www/React-prod.modern.js +8.34% 17.05 kB 18.47 kB +6.27% 4.39 kB 4.66 kB
facebook-www/React-prod.classic.js +8.27% 17.20 kB 18.62 kB +6.20% 4.43 kB 4.71 kB
facebook-www/React-profiling.modern.js +8.05% 17.66 kB 19.08 kB +6.11% 4.51 kB 4.79 kB
facebook-www/React-profiling.classic.js +7.99% 17.81 kB 19.23 kB +6.05% 4.56 kB 4.84 kB
oss-experimental/react/cjs/react.production.min.js +7.76% 7.63 kB 8.22 kB +5.72% 2.92 kB 3.09 kB
oss-experimental/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-stable/react-client/cjs/react-client-flight.production.min.js +7.19% 3.47 kB 3.71 kB +8.60% 1.57 kB 1.70 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js +6.55% 3.96 kB 4.22 kB +7.72% 1.76 kB 1.90 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js +6.48% 3.75 kB 4.00 kB +7.87% 1.67 kB 1.80 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-stable/react-client/cjs/react-client-flight.development.js +6.12% 13.02 kB 13.82 kB +5.85% 3.85 kB 4.07 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js +5.12% 15.57 kB 16.36 kB +5.18% 4.48 kB 4.71 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.development.js +5.08% 16.73 kB 17.58 kB +5.17% 4.60 kB 4.84 kB
oss-experimental/react/umd/react.profiling.min.js +5.00% 11.41 kB 11.98 kB +3.94% 4.47 kB 4.65 kB
oss-experimental/react/umd/react.production.min.js +5.00% 11.41 kB 11.98 kB +3.94% 4.47 kB 4.65 kB
oss-experimental/react/cjs/react.development.js +3.23% 89.15 kB 92.02 kB +3.11% 23.98 kB 24.72 kB
oss-experimental/react/umd/react.development.js +2.78% 111.55 kB 114.65 kB +2.83% 28.60 kB 29.41 kB
facebook-www/React-dev.modern.js +2.55% 113.52 kB 116.41 kB +2.68% 28.09 kB 28.85 kB
facebook-www/React-dev.classic.js +2.52% 114.54 kB 117.43 kB +2.68% 28.29 kB 29.04 kB
facebook-react-native/react-is/cjs/ReactIs-prod.js +2.44% 4.59 kB 4.70 kB +1.25% 1.12 kB 1.13 kB
facebook-react-native/react-is/cjs/ReactIs-profiling.js +2.44% 4.59 kB 4.70 kB +1.25% 1.12 kB 1.13 kB
facebook-www/ReactIs-prod.classic.js +2.25% 4.98 kB 5.09 kB +1.13% 1.24 kB 1.26 kB
facebook-www/ReactIs-prod.modern.js +2.25% 4.98 kB 5.09 kB +1.13% 1.24 kB 1.26 kB
oss-stable-semver/react-is/cjs/react-is.production.min.js +1.95% 2.26 kB 2.31 kB +1.66% 0.78 kB 0.80 kB
oss-stable/react-is/cjs/react-is.production.min.js +1.95% 2.26 kB 2.31 kB +1.66% 0.78 kB 0.80 kB
oss-experimental/react-is/cjs/react-is.production.min.js +1.92% 2.30 kB 2.34 kB +1.51% 0.80 kB 0.81 kB
oss-stable-semver/react-is/umd/react-is.production.min.js +1.91% 2.31 kB 2.35 kB +1.39% 0.87 kB 0.88 kB
oss-stable/react-is/umd/react-is.production.min.js +1.91% 2.31 kB 2.35 kB +1.39% 0.87 kB 0.88 kB
oss-experimental/react-is/umd/react-is.production.min.js +1.88% 2.34 kB 2.38 kB +1.49% 0.88 kB 0.89 kB
facebook-www/ReactFlightDOMRelayClient-dev.classic.js +1.72% 10.40 kB 10.58 kB +2.86% 3.07 kB 3.16 kB
facebook-www/ReactFlightDOMRelayClient-dev.modern.js +1.72% 10.40 kB 10.58 kB +2.86% 3.07 kB 3.16 kB
facebook-relay/flight/ReactFlightNativeRelayClient-dev.js +1.72% 10.40 kB 10.58 kB +2.90% 3.07 kB 3.16 kB
facebook-react-native/react-is/cjs/ReactIs-dev.js +1.59% 7.16 kB 7.28 kB +0.88% 1.94 kB 1.95 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js +1.58% 18.13 kB 18.42 kB +1.38% 5.22 kB 5.29 kB
oss-experimental/react-is/cjs/react-is.development.js +1.58% 7.23 kB 7.34 kB +0.86% 1.98 kB 1.99 kB
oss-stable-semver/react-is/cjs/react-is.development.js +1.54% 7.42 kB 7.54 kB +0.83% 2.05 kB 2.06 kB
oss-stable/react-is/cjs/react-is.development.js +1.54% 7.42 kB 7.54 kB +0.83% 2.05 kB 2.06 kB
oss-experimental/react-is/umd/react-is.development.js +1.52% 7.78 kB 7.89 kB +0.68% 2.06 kB 2.07 kB
oss-stable-semver/react-is/umd/react-is.development.js +1.48% 7.98 kB 8.09 kB +0.80% 2.13 kB 2.15 kB
oss-stable/react-is/umd/react-is.development.js +1.48% 7.98 kB 8.09 kB +0.80% 2.13 kB 2.15 kB
facebook-www/ReactIs-dev.modern.js +1.21% 9.45 kB 9.57 kB +0.63% 2.54 kB 2.55 kB
facebook-www/ReactIs-dev.classic.js +1.21% 9.45 kB 9.57 kB +0.63% 2.54 kB 2.55 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +0.88% 2.05 kB 2.07 kB +0.83% 0.84 kB 0.85 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +0.88% 2.05 kB 2.07 kB +0.83% 0.84 kB 0.85 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.development.js +0.88% 2.05 kB 2.07 kB +0.83% 0.84 kB 0.85 kB
oss-experimental/react-server/cjs/react-server.production.min.js +0.86% 19.92 kB 20.09 kB +0.76% 6.86 kB 6.91 kB
facebook-react-native/react/cjs/React-prod.js +0.76% 16.97 kB 17.10 kB +0.74% 4.35 kB 4.38 kB
facebook-react-native/react/cjs/React-profiling.js +0.73% 17.58 kB 17.71 kB +0.67% 4.48 kB 4.51 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js +0.70% 41.15 kB 41.44 kB +0.50% 12.05 kB 12.11 kB
oss-experimental/react/cjs/react-jsx-runtime.development.js +0.69% 41.75 kB 42.04 kB +0.50% 12.23 kB 12.29 kB
facebook-www/JSXDEVRuntime-dev.modern.js +0.61% 45.02 kB 45.29 kB +0.51% 12.78 kB 12.84 kB
facebook-www/JSXDEVRuntime-dev.classic.js +0.61% 45.02 kB 45.29 kB +0.50% 12.78 kB 12.84 kB
oss-stable-semver/react/cjs/react.production.min.js +0.54% 6.90 kB 6.94 kB +0.41% 2.71 kB 2.72 kB
oss-stable/react/cjs/react.production.min.js +0.54% 6.90 kB 6.94 kB +0.41% 2.71 kB 2.72 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.53% 32.61 kB 32.78 kB +0.50% 10.98 kB 11.03 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.53% 32.46 kB 32.63 kB +0.48% 10.83 kB 10.88 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +0.51% 33.72 kB 33.90 kB +0.44% 11.59 kB 11.64 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +0.51% 33.59 kB 33.76 kB +0.47% 11.46 kB 11.52 kB
oss-experimental/react/cjs/react.shared-subset.development.js +0.51% 74.37 kB 74.75 kB +0.49% 20.29 kB 20.39 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.47% 36.20 kB 36.37 kB +0.46% 12.07 kB 12.13 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +0.47% 36.43 kB 36.60 kB +0.46% 12.24 kB 12.30 kB
oss-experimental/react-server/cjs/react-server.development.js +0.46% 124.43 kB 125.00 kB +0.40% 31.24 kB 31.36 kB
facebook-www/ReactDOMServer-prod.classic.js +0.42% 47.06 kB 47.26 kB +0.23% 11.01 kB 11.04 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +0.39% 1.02 kB 1.02 kB +0.76% 0.53 kB 0.53 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +0.39% 1.02 kB 1.02 kB +0.76% 0.53 kB 0.53 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +0.39% 1.02 kB 1.02 kB +0.76% 0.53 kB 0.53 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +0.37% 19.68 kB 19.76 kB +0.37% 6.79 kB 6.82 kB
oss-stable/react-server/cjs/react-server.production.min.js +0.37% 19.68 kB 19.76 kB +0.37% 6.79 kB 6.82 kB
oss-stable-semver/react/umd/react.profiling.min.js +0.34% 10.72 kB 10.76 kB +0.35% 4.26 kB 4.28 kB
oss-stable/react/umd/react.profiling.min.js +0.34% 10.72 kB 10.76 kB +0.35% 4.26 kB 4.28 kB
oss-stable-semver/react/umd/react.production.min.js +0.34% 10.73 kB 10.76 kB +0.35% 4.26 kB 4.28 kB
oss-stable/react/umd/react.production.min.js +0.34% 10.73 kB 10.76 kB +0.35% 4.26 kB 4.28 kB
facebook-www/ReactDOMServer-prod.modern.js +0.33% 74.89 kB 75.14 kB +0.48% 15.48 kB 15.55 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +0.32% 76.71 kB 76.96 kB +0.49% 16.28 kB 16.36 kB
facebook-react-native/react/cjs/React-dev.js +0.31% 104.57 kB 104.89 kB +0.41% 25.58 kB 25.69 kB
oss-experimental/react/cjs/react.shared-subset.production.min.js +0.30% 6.39 kB 6.41 kB +0.46% 2.61 kB 2.62 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js +0.28% 18.02 kB 18.07 kB +0.31% 5.19 kB 5.21 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js +0.28% 18.02 kB 18.07 kB +0.31% 5.19 kB 5.21 kB
oss-stable-semver/react-server/cjs/react-server.development.js +0.27% 123.80 kB 124.13 kB +0.28% 31.07 kB 31.16 kB
oss-stable/react-server/cjs/react-server.development.js +0.27% 123.80 kB 124.13 kB +0.28% 31.07 kB 31.16 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.25% 228.18 kB 228.75 kB +0.21% 55.54 kB 55.65 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.25% 230.55 kB 231.12 kB +0.24% 56.02 kB 56.16 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +0.25% 242.00 kB 242.59 kB +0.25% 56.62 kB 56.76 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +0.25% 229.85 kB 230.42 kB +0.20% 56.14 kB 56.25 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +0.24% 232.25 kB 232.82 kB +0.24% 56.50 kB 56.64 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +0.24% 241.25 kB 241.84 kB +0.20% 56.72 kB 56.84 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +0.24% 230.12 kB 230.67 kB +0.22% 55.10 kB 55.22 kB
facebook-www/ReactDOMServer-dev.modern.js +0.24% 233.53 kB 234.08 kB +0.26% 55.86 kB 56.01 kB
oss-experimental/react-art/cjs/react-art.production.min.js +0.23% 86.64 kB 86.84 kB +0.18% 26.73 kB 26.78 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.22% 32.15 kB 32.23 kB +0.25% 10.72 kB 10.74 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.22% 32.15 kB 32.23 kB +0.25% 10.72 kB 10.74 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.min.js +0.22% 97.43 kB 97.65 kB +0.15% 29.79 kB 29.83 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.22% 32.30 kB 32.38 kB +0.22% 10.86 kB 10.88 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.22% 32.30 kB 32.38 kB +0.22% 10.86 kB 10.88 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +0.22% 33.29 kB 33.36 kB +0.24% 11.36 kB 11.38 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +0.22% 33.29 kB 33.36 kB +0.24% 11.36 kB 11.38 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +0.22% 33.42 kB 33.49 kB +0.29% 11.48 kB 11.51 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +0.22% 33.42 kB 33.49 kB +0.29% 11.48 kB 11.51 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.min.js +0.21% 106.33 kB 106.54 kB +0.18% 32.08 kB 32.14 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.20% 35.84 kB 35.91 kB +0.23% 11.95 kB 11.98 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.20% 35.84 kB 35.91 kB +0.23% 11.95 kB 11.98 kB

Generated by 🚫 dangerJS against b6bbe30

@salazarm salazarm changed the base branch from main to 0.3-stable March 7, 2022 19:33
@salazarm salazarm changed the base branch from 0.3-stable to main March 7, 2022 19:34
@@ -244,7 +245,14 @@ export function popProvider<T>(context: ReactContext<T>): ContextSnapshot {
}
}
if (isPrimaryRenderer) {
prevSnapshot.context._currentValue = prevSnapshot.parentValue;
const value = prevSnapshot.parentValue;
if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this isn't necessary right now since we can't pass Context through context (yet), once we add that, during a refetch we'd be able to send a context back up to the server and useContext it before its initialized. We should add a warning though if it was never initialized at all though, same thing could happen on the client once we add the ability to send the context itself.

@@ -22,6 +22,7 @@ export {
createElement,
createFactory,
createRef,
createServerContext,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't export this in stable yet unless we want it in the RC.

if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
prevSnapshot.context._currentValue =
// $FlowExpectedError - Effectively refined context to ServerContext
(prevSnapshot.context: ReactServerContext<any>)._defaultValue;
Copy link
Collaborator

@sebmarkbage sebmarkbage Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to refine this since _defaultValue is on client contexts too. It's not necessary but doesn't hurt to have it on client contexts too. In theory it could be useful.

if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
prevSnapshot.context._currentValue2 =
// $FlowExpectedError - Effectively refined context to ServerContext
(prevSnapshot.context: ReactServerContext<any>)._defaultValue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -132,9 +137,17 @@ export function popProvider(
const currentValue = valueCursor.current;
pop(valueCursor, providerFiber);
if (isPrimaryRenderer) {
context._currentValue = currentValue;
if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
context._currentValue = ((context: any): ReactServerContext<any>)._defaultValue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need refining neither. It could in theory be useful for the client context too in the future. So it's not wrong to apply it to both. Also helps us stay sound(er).

} else {
context._currentValue2 = currentValue;
if (currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
context._currentValue2 = ((context: any): ReactServerContext<any>)._defaultValue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too.

return (undefined: any);
}

if (value.$$typeof === REACT_PROVIDER_TYPE) {
Copy link
Collaborator

@sebmarkbage sebmarkbage Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You check for value being truthy in the other if above this but not here. Either it's never null/undefined or you need the check here too. Can it be undefined?

I'd just solve this by moving them into the typeof value === 'object' branch below though so that you only check this on actual objects and only do that check once. They're never null because there's a check above.

Copy link
Collaborator

@sebmarkbage sebmarkbage Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also make it a switch statement.

Since you probably match fewer contexts than module references in a tree (given that each child component is a module reference) you can probably move this after the isModuleReference check.

isModuleReference actually also compiles to a $$typeof check so ideally the compiler or VM can optimize to a single switch/jmptable.

@@ -85,6 +86,8 @@ export default function getComponentNameFromType(type: mixed): string | null {
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_SERVER_CONTEXT_TYPE:
return ((type: any): ReactContext<any>)._globalName + '.Provider';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a .displayName we should probably use that like for other contexts and then fallback to _globalName if it doesn't exist.

This should also be wrapped in the feature flag condition and moved to the bottom of the switch. That way it will fallthrough if the condition fails and therefore the case can be removed and therefore the symbol.

return serializeByValueID(providerId);
}
case REACT_SERVER_CONTEXT_TYPE: {
if (key === '__pop') {
Copy link
Collaborator

@sebmarkbage sebmarkbage Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure when in the refactors this happened but this is not quite safe now.

Because if you passed something like <ClientComponent __pop={context} /> it would pop.

It might be better to let the value be a magical value like a specific object reference that the user can't provide.

You don't need the context in the value anyway since it's just a DEV only thing for ourselves to help debugging you can remove that part from popProvider.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That way you don't even have to check the key.

You can just do if (value === POP).

@salazarm salazarm merged commit d5f1b06 into facebook:main Mar 8, 2022
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Mar 24, 2022
Summary:
This sync includes the following changes:
- **[3f8990898](facebook/react@3f8990898 )**: Fix test-build-devtools if build was generated by build-for-devtools ([#24088](facebook/react#24088)) //<Sebastian Silbermann>//
- **[577f2de46](facebook/react@577f2de46 )**: enableCacheElement flag ([#24131](facebook/react#24131)) //<David McCabe>//
- **[2e0d86d22](facebook/react@2e0d86d22 )**: Allow updating dehydrated root at lower priority without forcing client render ([#24082](facebook/react#24082)) //<Andrew Clark>//
- **[dbe9e732a](facebook/react@dbe9e732a )**: Avoid conditions where control flow is sufficient ([#24126](facebook/react#24126)) //<Sebastian Markbåge>//
- **[b075f9742](facebook/react@b075f9742 )**: Fix dispatch config type for skipBubbling ([#24109](facebook/react#24109)) //<Luna>//
- **[ef23a9ee8](facebook/react@ef23a9ee8 )**: Flag for text hydration mismatch ([#24107](facebook/react#24107)) //<salazarm>//
- **[0412f0c1a](facebook/react@0412f0c1a )**: add offscreen state node ([#24026](facebook/react#24026)) //<Luna Ruan>//
- **[43eb28339](facebook/react@43eb28339 )**: Add skipBubbling property to dispatch config ([#23366](facebook/react#23366)) //<Luna>//
- **[832e2987e](facebook/react@832e2987e )**: Revert accdientally merged PR ([#24081](facebook/react#24081)) //<Andrew Clark>//
- **[02b65fd8c](facebook/react@02b65fd8c )**: Allow updates at lower pri without forcing client render //<Andrew Clark>//
- **[83b941a51](facebook/react@83b941a51 )**: Add isRootDehydrated function //<Andrew Clark>//
- **[c8e4789e2](facebook/react@c8e4789e2 )**: Pass children to hydration root constructor //<Andrew Clark>//
- **[581f0c42e](facebook/react@581f0c42e )**: [Flight] add support for Lazy components in Flight server ([#24068](facebook/react#24068)) //<Josh Story>//
- **[72a933d28](facebook/react@72a933d28 )**: Gate legacy hidden ([#24047](facebook/react#24047)) //<Sebastian Markbåge>//
- **[b9de50d2f](facebook/react@b9de50d2f )**: Update test to reset modules instead of using private state ([#24055](facebook/react#24055)) //<Sebastian Markbåge>//
- **[c91892ec3](facebook/react@c91892ec3 )**: [Fizz] Don't flush empty segments ([#24054](facebook/react#24054)) //<Sebastian Markbåge>//
- **[d5f1b067c](facebook/react@d5f1b067c )**: [ServerContext] Flight support for ServerContext ([#23244](facebook/react#23244)) //<salazarm>//
- **[6edd55a3f](facebook/react@6edd55a3f )**: Gate unstable_expectedLoadTime on enableCPUSuspense ([#24038](facebook/react#24038)) //<Sebastian Markbåge>//
- **[57799b912](facebook/react@57799b912 )**: Add more feature flag checks ([#24037](facebook/react#24037)) //<Sebastian Markbåge>//
- **[e09518e5b](facebook/react@e09518e5b )**: [Fizz] write chunks to a buffer with no re-use ([#24034](facebook/react#24034)) //<Josh Story>//
- **[14c2be8da](facebook/react@14c2be8da )**: Rename Node SSR Callbacks to onShellReady/onAllReady and Other Fixes ([#24030](facebook/react#24030)) //<Sebastian Markbåge>//
- **[cb1e7b1c6](facebook/react@cb1e7b1c6 )**: Move onCompleteAll to .allReady Promise ([#24025](facebook/react#24025)) //<Sebastian Markbåge>//
- **[566285761](facebook/react@566285761 )**: [Fizz] Export debug function for FB ([#24024](facebook/react#24024)) //<salazarm>//
- **[05c283c3c](facebook/react@05c283c3c )**: Fabric HostComponent as EventEmitter: support add/removeEventListener (unstable only) ([#23386](facebook/react#23386)) //<Joshua Gross>//
- **[08644348b](facebook/react@08644348b )**: Added unit Tests in the ReactART, increasing the code coverage ([#23195](facebook/react#23195)) //<BIKI DAS>//
- **[feefe437f](facebook/react@feefe437f )**: Refactor Cache Code ([#23393](facebook/react#23393)) //<Luna Ruan>//

Changelog:
[General][Changed] - React Native sync for revisions 1780659...1159ff6

jest_e2e[run_all_tests]

Reviewed By: lunaleaps

Differential Revision: D34928167

fbshipit-source-id: 8c386f2be5871981d217ab9a514892ed88eafcfb
@gaearon gaearon mentioned this pull request Mar 30, 2022
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
* Flight side of server context

* 1 more test

* rm unused function

* flow+prettier

* flow again =)

* duplicate ReactServerContext across packages

* store default value when lazily initializing server context

* .

* better comment

* derp... missing import

* rm optional chaining

* missed feature flag

* React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ??

* add warning if non ServerContext passed into useServerContext

* pass context in as array of arrays

* make importServerContext nott pollute the global context state

* merge main

* remove useServerContext

* dont rely on object getters in ReactServerContext and disallow JSX

* add symbols to devtools + rename globalServerContextRegistry to just ContextRegistry

* gate test case as experimental

* feedback

* remove unions

* Lint

* fix oopsies (tests/lint/mismatching arguments/signatures

* lint again

* replace-fork

* remove extraneous change

* rebase

* 1 more test

* rm unused function

* flow+prettier

* flow again =)

* duplicate ReactServerContext across packages

* store default value when lazily initializing server context

* .

* better comment

* derp... missing import

* rm optional chaining

* missed feature flag

* React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ??

* add warning if non ServerContext passed into useServerContext

* pass context in as array of arrays

* make importServerContext nott pollute the global context state

* merge main

* remove useServerContext

* dont rely on object getters in ReactServerContext and disallow JSX

* add symbols to devtools + rename globalServerContextRegistry to just ContextRegistry

* gate test case as experimental

* feedback

* remove unions

* Lint

* fix oopsies (tests/lint/mismatching arguments/signatures

* lint again

* replace-fork

* remove extraneous change

* rebase

* reinline

* rebase

* add back changes lost due to rebase being hard

* emit chunk for provider

* remove case for React provider type

* update type for SomeChunk

* enable flag with experimental

* add missing types

* fix flow type

* missing type

* t: any

* revert extraneous type change

* better type

* better type

* feedback

* change import to type import

* test?

* test?

* remove react-dom

* remove react-native-renderer from react-server-native-relay/package.json

* gate change in FiberNewContext, getComponentNameFromType, use switch statement in FlightServer

* getComponentNameFromTpe: server context type gated and use displayName if available

* fallthrough

* lint....

* POP

* lint
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
Summary:
This sync includes the following changes:
- **[3f8990898](facebook/react@3f8990898 )**: Fix test-build-devtools if build was generated by build-for-devtools ([facebook#24088](facebook/react#24088)) //<Sebastian Silbermann>//
- **[577f2de46](facebook/react@577f2de46 )**: enableCacheElement flag ([facebook#24131](facebook/react#24131)) //<David McCabe>//
- **[2e0d86d22](facebook/react@2e0d86d22 )**: Allow updating dehydrated root at lower priority without forcing client render ([facebook#24082](facebook/react#24082)) //<Andrew Clark>//
- **[dbe9e732a](facebook/react@dbe9e732a )**: Avoid conditions where control flow is sufficient ([facebook#24126](facebook/react#24126)) //<Sebastian Markbåge>//
- **[b075f9742](facebook/react@b075f9742 )**: Fix dispatch config type for skipBubbling ([facebook#24109](facebook/react#24109)) //<Luna>//
- **[ef23a9ee8](facebook/react@ef23a9ee8 )**: Flag for text hydration mismatch ([facebook#24107](facebook/react#24107)) //<salazarm>//
- **[0412f0c1a](facebook/react@0412f0c1a )**: add offscreen state node ([facebook#24026](facebook/react#24026)) //<Luna Ruan>//
- **[43eb28339](facebook/react@43eb28339 )**: Add skipBubbling property to dispatch config ([facebook#23366](facebook/react#23366)) //<Luna>//
- **[832e2987e](facebook/react@832e2987e )**: Revert accdientally merged PR ([facebook#24081](facebook/react#24081)) //<Andrew Clark>//
- **[02b65fd8c](facebook/react@02b65fd8c )**: Allow updates at lower pri without forcing client render //<Andrew Clark>//
- **[83b941a51](facebook/react@83b941a51 )**: Add isRootDehydrated function //<Andrew Clark>//
- **[c8e4789e2](facebook/react@c8e4789e2 )**: Pass children to hydration root constructor //<Andrew Clark>//
- **[581f0c42e](facebook/react@581f0c42e )**: [Flight] add support for Lazy components in Flight server ([facebook#24068](facebook/react#24068)) //<Josh Story>//
- **[72a933d28](facebook/react@72a933d28 )**: Gate legacy hidden ([facebook#24047](facebook/react#24047)) //<Sebastian Markbåge>//
- **[b9de50d2f](facebook/react@b9de50d2f )**: Update test to reset modules instead of using private state ([facebook#24055](facebook/react#24055)) //<Sebastian Markbåge>//
- **[c91892ec3](facebook/react@c91892ec3 )**: [Fizz] Don't flush empty segments ([facebook#24054](facebook/react#24054)) //<Sebastian Markbåge>//
- **[d5f1b067c](facebook/react@d5f1b067c )**: [ServerContext] Flight support for ServerContext ([facebook#23244](facebook/react#23244)) //<salazarm>//
- **[6edd55a3f](facebook/react@6edd55a3f )**: Gate unstable_expectedLoadTime on enableCPUSuspense ([facebook#24038](facebook/react#24038)) //<Sebastian Markbåge>//
- **[57799b912](facebook/react@57799b912 )**: Add more feature flag checks ([facebook#24037](facebook/react#24037)) //<Sebastian Markbåge>//
- **[e09518e5b](facebook/react@e09518e5b )**: [Fizz] write chunks to a buffer with no re-use ([facebook#24034](facebook/react#24034)) //<Josh Story>//
- **[14c2be8da](facebook/react@14c2be8da )**: Rename Node SSR Callbacks to onShellReady/onAllReady and Other Fixes ([facebook#24030](facebook/react#24030)) //<Sebastian Markbåge>//
- **[cb1e7b1c6](facebook/react@cb1e7b1c6 )**: Move onCompleteAll to .allReady Promise ([facebook#24025](facebook/react#24025)) //<Sebastian Markbåge>//
- **[566285761](facebook/react@566285761 )**: [Fizz] Export debug function for FB ([facebook#24024](facebook/react#24024)) //<salazarm>//
- **[05c283c3c](facebook/react@05c283c3c )**: Fabric HostComponent as EventEmitter: support add/removeEventListener (unstable only) ([facebook#23386](facebook/react#23386)) //<Joshua Gross>//
- **[08644348b](facebook/react@08644348b )**: Added unit Tests in the ReactART, increasing the code coverage ([facebook#23195](facebook/react#23195)) //<BIKI DAS>//
- **[feefe437f](facebook/react@feefe437f )**: Refactor Cache Code ([facebook#23393](facebook/react#23393)) //<Luna Ruan>//

Changelog:
[General][Changed] - React Native sync for revisions 1780659...1159ff6

jest_e2e[run_all_tests]

Reviewed By: lunaleaps

Differential Revision: D34928167

fbshipit-source-id: 8c386f2be5871981d217ab9a514892ed88eafcfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants