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] Better compat with http.createServer #17289

Merged
merged 1 commit into from
Nov 6, 2019

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 6, 2019

Don't know if we care in longer term but I use http.createServer for testing and that has older Node streams. They don't have cork and uncork. Also the flush on that object was misleading (because it was only used for flushing headers) so it fires a deprecation warning.

That's a few workarounds to make it work with http.createServer. Maybe we'll remove it later but that's the most convincing way to "really" test it that I found so far.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 6, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c36a1b3:

Sandbox Source
lucid-newton-2pkkt Configuration

@sizebot
Copy link

sizebot commented Nov 6, 2019

Size changes (stable)

ReactDOM: size: 0.0%, gzip: -0.2%

Details of bundled changes.

Comparing: 62ef250...c36a1b3

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.57 KB 3.57 KB NODE_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% -0.1% 1.12 KB 1.12 KB 679 B 678 B NODE_PROD
react-dom-unstable-flight-client.development.js 0.0% -0.1% 4.83 KB 4.83 KB 1.59 KB 1.59 KB UMD_DEV
react-dom-unstable-flight-client.production.min.js 0.0% -0.2% 1.78 KB 1.78 KB 866 B 864 B UMD_PROD
react-dom-server.browser.development.js 0.0% -0.0% 136.28 KB 136.28 KB 35.86 KB 35.86 KB NODE_DEV
react-dom-unstable-flight-server.node.development.js +10.1% +7.0% 4.49 KB 4.95 KB 1.77 KB 1.9 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.85 KB 19.85 KB 7.38 KB 7.38 KB NODE_PROD
react-dom-unstable-flight-server.node.production.min.js 🔺+7.8% 🔺+3.2% 1.18 KB 1.28 KB 712 B 735 B NODE_PROD
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.production.min.js 0.0% -0.3% 1.2 KB 1.2 KB 703 B 701 B UMD_PROD
react-dom.profiling.min.js 0.0% -0.0% 119.73 KB 119.73 KB 38.49 KB 38.49 KB UMD_PROFILING
react-dom.development.js 0.0% -0.0% 945.53 KB 945.53 KB 213.41 KB 213.41 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 116.3 KB 116.3 KB 36.79 KB 36.79 KB NODE_PROD
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 634 B 633 B NODE_PROD
react-dom-unstable-flight-server.browser.development.js 0.0% -0.1% 4.44 KB 4.44 KB 1.79 KB 1.79 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.0% 10.72 KB 10.72 KB 3.67 KB 3.67 KB UMD_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% -0.3% 1.32 KB 1.32 KB 761 B 759 B UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 59.8 KB 59.8 KB 15.66 KB 15.65 KB NODE_DEV
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.23 KB 4.23 KB 1.73 KB 1.73 KB NODE_DEV
react-dom-server.node.development.js 0.0% -0.0% 137.39 KB 137.39 KB 36.09 KB 36.08 KB NODE_DEV
react-dom-test-utils.development.js 0.0% -0.0% 56.26 KB 56.26 KB 15.58 KB 15.57 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 20.26 KB 20.26 KB 7.53 KB 7.53 KB NODE_PROD
react-dom-unstable-flight-client.production.min.js 0.0% -0.1% 1.61 KB 1.61 KB 792 B 791 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-test-utils.development.js 0.0% -0.0% 54.53 KB 54.53 KB 15.24 KB 15.24 KB NODE_DEV
react-dom-unstable-fizz.node.development.js +11.5% +8.6% 3.96 KB 4.41 KB 1.52 KB 1.65 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.87 KB 36.86 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 🔺+8.3% 🔺+3.0% 1.11 KB 1.2 KB 668 B 688 B NODE_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.93 KB 19.93 KB 7.39 KB 7.38 KB UMD_PROD

Generated by 🚫 dangerJS against c36a1b3

@sizebot
Copy link

sizebot commented Nov 6, 2019

Size changes (experimental)

ReactDOM: size: 0.0%, gzip: -0.0%

Details of bundled changes.

Comparing: 62ef250...c36a1b3

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js 0.0% -0.0% 123.54 KB 123.54 KB 38.79 KB 38.79 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 140.37 KB 140.37 KB 36.87 KB 36.86 KB UMD_DEV
react-dom-unstable-flight-server.browser.development.js 0.0% +0.1% 4.45 KB 4.45 KB 1.79 KB 1.79 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.39 KB 20.39 KB 7.48 KB 7.48 KB UMD_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% -0.4% 1.33 KB 1.33 KB 770 B 767 B UMD_PROD
react-dom-test-utils.development.js 0.0% -0.0% 56.27 KB 56.27 KB 15.58 KB 15.58 KB UMD_DEV
react-dom-unstable-flight-client.development.js 0.0% -0.1% 4.84 KB 4.84 KB 1.6 KB 1.6 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.3% 1.21 KB 1.21 KB 711 B 709 B UMD_PROD
react-dom-unstable-flight-client.production.min.js 0.0% -0.1% 1.79 KB 1.79 KB 875 B 874 B UMD_PROD
ReactDOMServer-dev.js 0.0% -0.0% 139.64 KB 139.64 KB 35.41 KB 35.41 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% -0.0% 54.54 KB 54.54 KB 15.25 KB 15.25 KB NODE_DEV
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-flight-client.development.js 0.0% -0.1% 4.67 KB 4.67 KB 1.55 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 642 B 641 B NODE_PROD
react-dom-unstable-flight-client.production.min.js 0.0% -0.2% 1.63 KB 1.63 KB 802 B 800 B NODE_PROD
react-dom.profiling.min.js 0.0% -0.0% 123.25 KB 123.25 KB 39.45 KB 39.45 KB UMD_PROFILING
ReactDOMFizzServer-dev.js +11.6% +8.5% 3.92 KB 4.37 KB 1.5 KB 1.63 KB FB_WWW_DEV
react-dom.development.js 0.0% -0.0% 945.55 KB 945.55 KB 213.43 KB 213.43 KB NODE_DEV
react-dom-server.node.development.js 0.0% -0.0% 137.41 KB 137.41 KB 36.09 KB 36.09 KB NODE_DEV
ReactDOMFizzServer-prod.js 🔺+6.6% 🔺+2.5% 2.19 KB 2.34 KB 888 B 910 B FB_WWW_PROD
react-dom-unstable-flight-server.node.development.js +10.1% +6.8% 4.51 KB 4.96 KB 1.79 KB 1.91 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 119.74 KB 119.74 KB 37.74 KB 37.73 KB NODE_PROD
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 🔺+7.7% 🔺+3.2% 1.2 KB 1.29 KB 722 B 745 B NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 136.3 KB 136.3 KB 35.87 KB 35.87 KB NODE_DEV
react-dom-unstable-flight-server.browser.development.js 0.0% -0.1% 4.25 KB 4.25 KB 1.74 KB 1.74 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.31 KB 20.31 KB 7.46 KB 7.46 KB NODE_PROD
react-dom-unstable-flight-server.browser.production.min.js 0.0% -0.1% 1.13 KB 1.13 KB 688 B 687 B NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.14 KB 60.14 KB 15.8 KB 15.8 KB UMD_DEV
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-dev.js 0.0% -0.0% 973.77 KB 973.77 KB 215.92 KB 215.92 KB FB_WWW_DEV
ReactFlightDOMServer-dev.js +10.2% +7.0% 4.44 KB 4.9 KB 1.75 KB 1.87 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 59.82 KB 59.82 KB 15.66 KB 15.66 KB NODE_DEV
react-dom-unstable-fizz.node.development.js +11.4% +8.5% 3.97 KB 4.43 KB 1.53 KB 1.66 KB NODE_DEV
ReactFlightDOMServer-prod.js 🔺+6.2% 🔺+3.0% 2.32 KB 2.46 KB 940 B 968 B FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 402.33 KB 402.33 KB 73.42 KB 73.42 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.48 KB 10.48 KB 3.58 KB 3.57 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 🔺+8.2% 🔺+3.0% 1.12 KB 1.21 KB 676 B 696 B NODE_PROD

Generated by 🚫 dangerJS against c36a1b3

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

Seems unfortunate to do these checks in the hot path but ok for now I guess.

I also wonder if the HTTP server always flushes at the end of the tick or what it does for buffering.

Would be bad if it waits for a few bytes that takes long to load before flushing the previous pieces.

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 6, 2019

I guess we'll see what objects returned by Express etc are like. Maybe they shield from this and we won't need it.

@gaearon gaearon merged commit f50f39b into facebook:master Nov 6, 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