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

Track thenable state in work loop #25538

Closed

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 22, 2022

Based on #25541

This is a refactor to track the array of thenables that is preserved across replays in the work loop instead of the Thenable module.

The reason is that I'm about to add additional state to the Thenable module that is specific to a particular attempt — like the current index — and is reset between replays. So it's helpful to keep the two kinds of state separate so it's clearer which state gets reset when.

The array of thenables is not reset until the work-in-progress either completes or unwinds.

This also makes the structure more similar to Fizz and Flight.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Oct 22, 2022
@sizebot
Copy link

sizebot commented Oct 22, 2022

Comparing: cce18e3...6ad6cdf

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 +0.08% 135.67 kB 135.78 kB +0.06% 43.46 kB 43.48 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.05% 154.31 kB 154.38 kB +0.04% 49.20 kB 49.22 kB
facebook-www/ReactDOM-prod.classic.js = 493.82 kB 493.77 kB = 87.89 kB 87.90 kB
facebook-www/ReactDOM-prod.modern.js = 479.08 kB 479.03 kB = 85.71 kB 85.71 kB
facebook-www/ReactDOMForked-prod.classic.js = 493.82 kB 493.77 kB = 87.89 kB 87.90 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +2.14% 13.07 kB 13.35 kB +1.08% 4.81 kB 4.86 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js = 54.85 kB 53.70 kB = 13.46 kB 13.07 kB
oss-stable/react-server/cjs/react-server-flight.development.js = 54.85 kB 53.70 kB = 13.46 kB 13.07 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js = 52.03 kB 50.87 kB = 12.99 kB 12.60 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/cjs/react-server-flight.production.min.js +2.14% 13.07 kB 13.35 kB +1.08% 4.81 kB 4.86 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +1.89% 33.55 kB 34.18 kB +0.85% 8.48 kB 8.55 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +1.88% 33.63 kB 34.26 kB +0.85% 8.51 kB 8.58 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +1.28% 21.78 kB 22.06 kB +0.68% 7.70 kB 7.75 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +1.27% 21.98 kB 22.26 kB +0.91% 7.78 kB 7.85 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +1.25% 22.16 kB 22.44 kB +0.71% 7.79 kB 7.84 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +0.30% 59.09 kB 59.27 kB = 14.51 kB 14.28 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-prod.js +0.26% 281.41 kB 282.13 kB +0.29% 49.94 kB 50.08 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.25% 697.21 kB 698.96 kB +0.31% 150.82 kB 151.29 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.25% 697.24 kB 698.98 kB +0.31% 150.85 kB 151.32 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.development.js +0.25% 730.35 kB 732.15 kB +0.31% 152.41 kB 152.88 kB
oss-stable/react-test-renderer/umd/react-test-renderer.development.js +0.25% 730.37 kB 732.18 kB +0.31% 152.43 kB 152.90 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.24% 719.08 kB 720.83 kB +0.30% 155.00 kB 155.47 kB
oss-stable/react-art/cjs/react-art.development.js +0.24% 719.10 kB 720.85 kB +0.30% 155.03 kB 155.49 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-profiling.js +0.24% 297.00 kB 297.72 kB +0.28% 52.29 kB 52.44 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +0.24% 86.05 kB 86.26 kB = 20.88 kB 20.65 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +0.24% 72.06 kB 72.24 kB = 17.90 kB 17.67 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +0.24% 72.12 kB 72.29 kB = 17.92 kB 17.69 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.24% 725.65 kB 727.40 kB +0.31% 156.54 kB 157.02 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.24% 739.75 kB 741.52 kB +0.30% 158.09 kB 158.56 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.development.js +0.24% 760.24 kB 762.05 kB +0.29% 158.21 kB 158.67 kB
facebook-www/ReactTestRenderer-dev.modern.js +0.23% 755.93 kB 757.70 kB +0.29% 161.29 kB 161.76 kB
facebook-www/ReactTestRenderer-dev.classic.js +0.23% 755.93 kB 757.70 kB +0.29% 161.29 kB 161.76 kB
react-native/implementations/ReactFabric-prod.js +0.23% 309.22 kB 309.94 kB +0.28% 54.75 kB 54.91 kB
react-native/implementations/ReactNativeRenderer-prod.js +0.23% 315.92 kB 316.64 kB +0.28% 55.82 kB 55.97 kB
react-native/implementations/ReactFabric-prod.fb.js +0.23% 319.60 kB 320.32 kB +0.25% 56.75 kB 56.89 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.22% 787.90 kB 789.65 kB +0.28% 167.60 kB 168.07 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.22% 787.92 kB 789.67 kB +0.28% 167.62 kB 168.09 kB
react-native/implementations/ReactNativeRenderer-prod.fb.js +0.22% 326.31 kB 327.03 kB +0.26% 57.83 kB 57.98 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.22% 81.90 kB 82.08 kB = 20.63 kB 20.38 kB
react-native/implementations/ReactFabric-profiling.js +0.22% 328.31 kB 329.03 kB +0.27% 57.89 kB 58.05 kB
oss-stable-semver/react-art/umd/react-art.development.js +0.22% 824.07 kB 825.87 kB +0.27% 173.13 kB 173.60 kB
oss-stable/react-art/umd/react-art.development.js +0.22% 824.09 kB 825.90 kB +0.27% 173.15 kB 173.63 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.22% 83.09 kB 83.27 kB = 20.68 kB 20.44 kB
react-native/implementations/ReactFabric-dev.js +0.22% 818.27 kB 820.04 kB +0.26% 177.01 kB 177.47 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.21% 335.10 kB 335.82 kB +0.27% 58.92 kB 59.08 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.21% 827.82 kB 829.59 kB +0.25% 179.46 kB 179.92 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.21% 346.38 kB 347.10 kB +0.27% 60.90 kB 61.06 kB
react-native/implementations/ReactFabric-dev.fb.js +0.21% 856.47 kB 858.24 kB +0.25% 184.33 kB 184.78 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +0.20% 866.00 kB 867.77 kB +0.25% 186.75 kB 187.22 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.20% 353.15 kB 353.87 kB +0.28% 62.01 kB 62.18 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js = 26.46 kB 26.40 kB = 6.38 kB 6.37 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 78.79 kB 77.64 kB = 19.58 kB 19.18 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 78.79 kB 77.64 kB = 19.58 kB 19.18 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 81.54 kB 80.35 kB = 19.78 kB 19.35 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js = 81.54 kB 80.35 kB = 19.78 kB 19.35 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 77.60 kB 76.45 kB = 19.52 kB 19.11 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 77.60 kB 76.45 kB = 19.52 kB 19.11 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js = 54.85 kB 53.70 kB = 13.46 kB 13.07 kB
oss-stable/react-server/cjs/react-server-flight.development.js = 54.85 kB 53.70 kB = 13.46 kB 13.07 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js = 52.03 kB 50.87 kB = 12.99 kB 12.60 kB

Generated by 🚫 dangerJS against 6ad6cdf

@acdlite acdlite force-pushed the track-thenable-state-in-work-loop branch 2 times, most recently from 6dcc87c to 7408748 Compare October 23, 2022 00:40
@acdlite acdlite marked this pull request as ready for review October 23, 2022 01:06
@acdlite acdlite force-pushed the track-thenable-state-in-work-loop branch from 7408748 to 56820b4 Compare October 23, 2022 03:23
Same as facebook#25537 but for Flight.

I was going to wait to do this later because the temporary
implementation of async components uses some of the same code that
non-used wakables do, but it's not so bad. I just had to inline one bit
of code, which we'll remove when we unify the implementation with `use`.
This is a refactor to track the array of thenables that is preserved
across replays in the work loop instead of the Thenable module.

The reason is that I'm about to add additional state to the Thenable
module that is specific to a particular attempt — like the current
index — and is reset between replays. So it's helpful to keep the two
kinds of state separate so it's clearer which state gets reset when.

The array of thenables is not reset until the work-in-progress either
completes or unwinds.

This also makes the structure more similar to Fizz and Flight.
@acdlite acdlite force-pushed the track-thenable-state-in-work-loop branch from 56820b4 to 6ad6cdf Compare October 23, 2022 05:10
@acdlite
Copy link
Collaborator Author

acdlite commented Oct 24, 2022

Closed by 7572e49

@acdlite acdlite closed this Oct 24, 2022
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.

3 participants