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

[Flight] Add Client Infrastructure #17234

Merged
merged 6 commits into from
Nov 1, 2019
Merged

Conversation

sebmarkbage
Copy link
Collaborator

This adds some infra to the client build so that we can parse a stream into an object that can suspend.

See the fixture for example.

@sizebot
Copy link

sizebot commented Oct 31, 2019

Size changes (stable)

ReactDOM: size: 🔺+4.8%, gzip: -10.4%

Details of bundled changes.

Comparing: bdcdb69...141bb4d

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.46 KB 10.46 KB 3.56 KB 3.56 KB NODE_PROD
react-dom-unstable-flight-client.development.js -4.4% -19.6% 5.05 KB 4.83 KB 1.98 KB 1.59 KB UMD_DEV
react-dom-unstable-flight-client.production.min.js 🔺+4.8% -10.4% 1.69 KB 1.78 KB 964 B 864 B UMD_PROD
react-dom.development.js 0.0% 0.0% 951.42 KB 951.42 KB 215 KB 215 KB UMD_DEV
react-dom.production.min.js 0.0% -0.0% 116.16 KB 116.16 KB 37.43 KB 37.43 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.7 KB 3.7 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.13 KB 60.13 KB 15.79 KB 15.79 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.04 KB 1.04 KB 633 B 632 B NODE_PROD
react-dom-unstable-flight-server.browser.development.js 0.0% 0.0% 5.13 KB 5.13 KB 2 KB 2 KB UMD_DEV
react-dom.profiling.min.js 0.0% 0.0% 119.99 KB 119.99 KB 37.84 KB 37.84 KB NODE_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.72 KB 10.72 KB 3.66 KB 3.67 KB UMD_PROD
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.84 KB 4.84 KB 1.88 KB 1.88 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 137.39 KB 137.39 KB 36.08 KB 36.08 KB NODE_DEV
react-dom-unstable-flight-client.development.js -2.2% -17.3% 4.76 KB 4.65 KB 1.87 KB 1.54 KB NODE_DEV
react-dom-test-utils.development.js 0.0% 0.0% 56.26 KB 56.26 KB 15.57 KB 15.57 KB UMD_DEV
react-dom-unstable-flight-client.production.min.js 🔺+10.8% -5.3% 1.46 KB 1.61 KB 834 B 790 B NODE_PROD
react-dom-test-utils.production.min.js 0.0% -0.0% 11.17 KB 11.17 KB 4.14 KB 4.14 KB UMD_PROD
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.96 KB 3.96 KB 1.52 KB 1.52 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.94 KB 10.94 KB 4.08 KB 4.08 KB NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 140.35 KB 140.35 KB 36.86 KB 36.86 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.1% 1.11 KB 1.11 KB 667 B 666 B NODE_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.93 KB 19.93 KB 7.38 KB 7.38 KB UMD_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer-flight-server.development.js -0.6% -0.7% 2.06 KB 2.05 KB 906 B 900 B NODE_DEV
react-noop-renderer-flight-server.production.min.js -1.3% -1.2% 902 B 890 B 511 B 505 B NODE_PROD
react-noop-renderer.development.js 0.0% 0.0% 34.98 KB 34.98 KB 8 KB 8 KB NODE_DEV
react-noop-renderer-server.development.js 0.0% +0.1% 1.97 KB 1.97 KB 897 B 898 B NODE_DEV
react-noop-renderer-flight-client.development.js -21.2% -14.4% 2.05 KB 1.62 KB 898 B 769 B NODE_DEV
react-noop-renderer-flight-client.production.min.js -37.3% -18.6% 895 B 561 B 506 B 412 B NODE_PROD

react-flight

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-flight.development.js -21.1% -22.1% 5.38 KB 4.25 KB 2.13 KB 1.66 KB NODE_DEV
react-flight.production.min.js -17.3% -21.7% 1.7 KB 1.41 KB 894 B 700 B NODE_PROD

Generated by 🚫 dangerJS against 141bb4d

@sizebot
Copy link

sizebot commented Oct 31, 2019

Size changes (experimental)

Details of bundled changes.

Comparing: bdcdb69...141bb4d

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-flight-server.browser.development.js 0.0% 0.0% 5.15 KB 5.15 KB 2.01 KB 2.01 KB UMD_DEV
react-dom-unstable-flight-client.development.js -4.3% -19.6% 5.06 KB 4.84 KB 1.99 KB 1.6 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 11.18 KB 11.18 KB 4.15 KB 4.15 KB UMD_PROD
react-dom-unstable-flight-client.production.min.js 🔺+4.8% -10.1% 1.71 KB 1.79 KB 971 B 873 B UMD_PROD
ReactDOMServer-prod.js 0.0% 0.0% 48.79 KB 48.79 KB 11.13 KB 11.13 KB FB_WWW_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.71 KB 3.71 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-unstable-flight-client.development.js -2.2% -17.2% 4.77 KB 4.67 KB 1.88 KB 1.55 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.05 KB 1.05 KB 641 B 640 B NODE_PROD
react-dom-unstable-flight-client.production.min.js 🔺+10.7% -5.1% 1.47 KB 1.63 KB 843 B 800 B NODE_PROD
react-dom-unstable-flight-server.node.development.js 0.0% +0.1% 5.12 KB 5.12 KB 1.92 KB 1.92 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 20.72 KB 20.72 KB 7.61 KB 7.61 KB NODE_PROD
react-dom-unstable-flight-server.node.production.min.js 0.0% -0.1% 1.55 KB 1.55 KB 874 B 873 B NODE_PROD
ReactFlightDOMClient-dev.js -1.3% -16.1% 4.7 KB 4.64 KB 1.83 KB 1.54 KB FB_WWW_DEV
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.85 KB 4.85 KB 1.89 KB 1.89 KB NODE_DEV
ReactFlightDOMClient-prod.js 🔺+14.0% -3.2% 2.86 KB 3.26 KB 1.07 KB 1.04 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.73 KB 10.73 KB 3.67 KB 3.67 KB UMD_PROD
ReactDOM-prod.js 0.0% 0.0% 401.5 KB 401.5 KB 72.88 KB 72.88 KB FB_WWW_PROD
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.97 KB 3.97 KB 1.53 KB 1.53 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.48 KB 10.48 KB 3.57 KB 3.57 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% -0.1% 1.12 KB 1.12 KB 675 B 674 B NODE_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js 0.0% 0.0% 35 KB 35 KB 8 KB 8 KB NODE_DEV
react-noop-renderer-flight-client.development.js -21.0% -14.1% 2.06 KB 1.63 KB 906 B 778 B NODE_DEV
react-noop-renderer.production.min.js 0.0% -0.0% 11.85 KB 11.85 KB 3.78 KB 3.78 KB NODE_PROD
react-noop-renderer-flight-client.production.min.js -36.8% -18.3% 908 B 574 B 515 B 421 B NODE_PROD
react-noop-renderer-flight-server.development.js -0.6% -0.7% 2.07 KB 2.06 KB 913 B 907 B NODE_DEV
react-noop-renderer-flight-server.production.min.js -1.3% -1.2% 915 B 903 B 520 B 514 B NODE_PROD
react-noop-renderer-persistent.development.js 0.0% 0.0% 35.11 KB 35.11 KB 8.02 KB 8.02 KB NODE_DEV
react-noop-renderer-persistent.production.min.js 0.0% -0.0% 11.87 KB 11.87 KB 3.79 KB 3.79 KB NODE_PROD

react-flight

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-flight.development.js -21.1% -21.9% 5.4 KB 4.26 KB 2.14 KB 1.67 KB NODE_DEV
react-flight.production.min.js -17.2% -21.5% 1.71 KB 1.42 KB 901 B 707 B NODE_PROD

Generated by 🚫 dangerJS against 141bb4d

We don't want unit tests but instead test how both server and clients work
together. So this merges server/client test files.
@sebmarkbage sebmarkbage force-pushed the flight branch 2 times, most recently from 60157da to 182f6ea Compare October 31, 2019 05:29
I'll probably end up deleting these deps later but they're here for now.
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

I'm not deep on the streams part but this makes sense to me

complete(response);
}
function error(e: ProgressEvent): void {
reportGlobalError(response, new TypeError('Network error'));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why TypeError?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should there be any protection around this being called more than once? E.g. if some failure events fire in a succession.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is supposed to mirror the type of fetch rejecting. Not sure what type that is.

There will be protection against multiple in the internals once we actually have an implementation.

@sebmarkbage sebmarkbage merged commit fadc971 into facebook:master Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants