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

[Fresh] Implement missing features #15860

Merged
merged 4 commits into from
Jun 11, 2019
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 11, 2019

Those are technically separate but I figured I'd put them in one PR instead of many small ones. I can separate if you prefer.

Commits:

  • e8f6894: Fixing an existing test to test the correct thing. It was supposed to test the annotation but I additionally had a variable rename there due to copy pasta. So I cleaned it up.

  • 892930d: This adds a new heuristic. If you edit useState() argument, like useState(0) -> useState(1), we'll remount. This will reinitialize the state, as you'd expect. This heuristic isn't perfect, e.g. it won't capture edits to a constant outside the parens, but it's good enough for the common case. I had to adjust a bunch of existing tests which started failing because of it.

  • 9e9a9dd: This makes it easy for the module system integration to determine whether there's any hot update that needs to be applied.

  • 6a062a3: A reincarnation of [React Fresh] Return host nodes for visual feedback #15688. That approach was bad because it highlighted nodes after hot update. That is distracting because you just want to see the new thing. Instead, I'm going with highlighting likely affected component before hot update is applied. So we can highlight the "old version", wait for update to come in (~100-200ms), and then replace it. This commit doesn't add any actual highlighting, but it adds the infrastructure necessary for it. Such as ability to query closest host nodes by a set of families. I verified it works and is sufficient in my playground.

The theme of this PR is to get to feature complete on the React side. The rest is integration.

gaearon added 3 commits June 10, 2019 20:30
This test included a change in variable name. It wasn't needed, and distracts from the actual thing being tested (the annotation).
prepareUpdate() now returns null if there are none.
@sizebot
Copy link

sizebot commented Jun 11, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: c403ae4...6a062a3

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% 109.24 KB 109.27 KB 34.7 KB 34.71 KB NODE_PROFILING
ReactDOM-dev.js +0.4% +0.3% 884.65 KB 887.78 KB 197 KB 197.63 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.69 KB 10.69 KB 3.67 KB 3.67 KB UMD_PROD
react-dom-unstable-fire.development.js +0.4% +0.3% 865.16 KB 868.27 KB 197.17 KB 197.79 KB UMD_DEV
react-dom-unstable-fire.production.min.js 0.0% 0.0% 105.92 KB 105.95 KB 34.45 KB 34.46 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js 0.0% 0.0% 109.07 KB 109.1 KB 35.41 KB 35.42 KB UMD_PROFILING
react-dom-unstable-fire.development.js +0.4% +0.3% 859.51 KB 862.63 KB 195.6 KB 196.22 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 135.35 KB 135.35 KB 35.84 KB 35.85 KB NODE_DEV
react-dom-unstable-fire.production.min.js 0.0% 0.0% 105.92 KB 105.95 KB 33.86 KB 33.87 KB NODE_PROD
react-dom.development.js +0.4% +0.3% 864.81 KB 867.93 KB 197.03 KB 197.65 KB UMD_DEV
react-dom-unstable-fire.profiling.min.js 0.0% 0.0% 109.25 KB 109.28 KB 34.71 KB 34.72 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 137.28 KB 137.28 KB 36.24 KB 36.24 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 105.91 KB 105.94 KB 34.44 KB 34.45 KB UMD_PROD
ReactFire-dev.js +0.4% +0.3% 883.86 KB 886.99 KB 196.92 KB 197.56 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 109.06 KB 109.09 KB 35.4 KB 35.41 KB UMD_PROFILING
ReactFire-prod.js 0.0% 0.0% 346.4 KB 346.44 KB 63.67 KB 63.68 KB FB_WWW_PROD
react-dom.development.js +0.4% +0.3% 859.17 KB 862.29 KB 195.46 KB 196.08 KB NODE_DEV
ReactFire-profiling.js 0.0% 0.0% 351.68 KB 351.72 KB 64.57 KB 64.58 KB FB_WWW_PROFILING
react-dom.production.min.js 0.0% 0.0% 105.9 KB 105.93 KB 33.85 KB 33.86 KB NODE_PROD
ReactDOM-prod.js 0.0% 0.0% 358.42 KB 358.46 KB 66.16 KB 66.17 KB FB_WWW_PROD
ReactDOMServer-prod.js 0.0% 0.0% 47.93 KB 47.93 KB 11.03 KB 11.03 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 364.87 KB 364.9 KB 67.26 KB 67.27 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.88 KB 3.88 KB 1.51 KB 1.51 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.43 KB 10.43 KB 3.56 KB 3.56 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.1 KB 1.1 KB 666 B 667 B NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.64 KB 3.64 KB 1.49 KB 1.49 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.56 KB 10.56 KB 3.92 KB 3.92 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.05 KB 1.05 KB 635 B 636 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.6% +0.6% 535.83 KB 538.96 KB 112.18 KB 112.81 KB FB_WWW_DEV
react-art.development.js +0.5% +0.5% 594.65 KB 597.77 KB 130.42 KB 131.04 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 97.11 KB 97.14 KB 29.91 KB 29.92 KB UMD_PROD
react-art.development.js +0.6% +0.6% 525.56 KB 528.67 KB 112.94 KB 113.56 KB NODE_DEV
react-art.production.min.js 0.0% 🔺+0.1% 62.09 KB 62.12 KB 19.19 KB 19.2 KB NODE_PROD
ReactART-prod.js 0.0% 0.0% 202.95 KB 202.99 KB 34.56 KB 34.57 KB FB_WWW_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.6% +0.5% 539.16 KB 542.27 KB 115.77 KB 116.4 KB UMD_DEV
react-test-renderer.production.min.js 0.0% 0.0% 63.42 KB 63.45 KB 19.63 KB 19.64 KB UMD_PROD
react-test-renderer.development.js +0.6% +0.5% 534.7 KB 537.81 KB 114.66 KB 115.28 KB NODE_DEV
react-test-renderer.production.min.js 0.0% 🔺+0.1% 63.11 KB 63.14 KB 19.41 KB 19.42 KB NODE_PROD
ReactTestRenderer-dev.js +0.6% +0.6% 547.14 KB 550.27 KB 114.69 KB 115.33 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 42.01 KB 42.01 KB 10.89 KB 10.89 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.6 KB 11.6 KB 3.55 KB 3.55 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% 0.0% 36.15 KB 36.15 KB 9.53 KB 9.53 KB NODE_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.74 KB 11.74 KB 3.67 KB 3.67 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-dev.js +0.5% +0.5% 658.93 KB 662.06 KB 140.04 KB 140.7 KB RN_FB_DEV
ReactFabric-prod.js 0.0% 0.0% 245.4 KB 245.44 KB 42.51 KB 42.52 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.5% +0.5% 670.06 KB 673.19 KB 142.67 KB 143.32 KB RN_OSS_DEV
ReactFabric-profiling.js 0.0% 0.0% 253.56 KB 253.6 KB 44.08 KB 44.09 KB RN_FB_PROFILING
ReactNativeRenderer-prod.js 0.0% 0.0% 252.62 KB 252.65 KB 43.69 KB 43.7 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 260.75 KB 260.78 KB 45.33 KB 45.34 KB RN_OSS_PROFILING
ReactNativeRenderer-dev.js +0.5% +0.5% 670.15 KB 673.28 KB 142.72 KB 143.37 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% 0.0% 252.61 KB 252.65 KB 43.71 KB 43.71 KB RN_FB_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 260.74 KB 260.77 KB 45.34 KB 45.35 KB RN_FB_PROFILING
ReactFabric-dev.js +0.5% +0.5% 658.83 KB 661.96 KB 140.01 KB 140.66 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% 0.0% 245.4 KB 245.44 KB 42.5 KB 42.51 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% 0.0% 253.56 KB 253.6 KB 44.07 KB 44.08 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-reflection.development.js 0.0% -0.0% 19.22 KB 19.22 KB 6.16 KB 6.16 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.51 KB 2.51 KB 1.11 KB 1.11 KB NODE_PROD
react-reconciler-persistent.development.js +0.6% +0.6% 521.12 KB 524.24 KB 110.35 KB 110.98 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% 0.0% 63.27 KB 63.3 KB 19 KB 19.01 KB NODE_PROD
react-reconciler.development.js +0.6% +0.6% 523.61 KB 526.73 KB 111.42 KB 112.04 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 63.26 KB 63.29 KB 19 KB 19 KB NODE_PROD

react-fresh

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-fresh-runtime.development.js +2.4% +1.5% 6.39 KB 6.55 KB 2.33 KB 2.37 KB NODE_DEV
react-fresh-runtime.production.min.js 🔺+3.9% 🔺+2.7% 1.79 KB 1.86 KB 963 B 989 B NODE_PROD
react-fresh-babel.development.js +2.0% +2.4% 21.1 KB 21.51 KB 4.35 KB 4.46 KB NODE_DEV
react-fresh-babel.production.min.js 🔺+2.3% 🔺+2.4% 6.16 KB 6.29 KB 2.11 KB 2.16 KB NODE_PROD

Generated by 🚫 dangerJS

@gaearon gaearon merged commit 1919206 into facebook:master Jun 11, 2019
@gaearon gaearon deleted the fresh-contd branch June 11, 2019 18:37
gaearon added a commit to gaearon/react that referenced this pull request Jun 19, 2019
* Fix existing test

This test included a change in variable name. It wasn't needed, and distracts from the actual thing being tested (the annotation).

* Reset state on edits to initial state argument

* Add a way to check whether there are hot updates

prepareUpdate() now returns null if there are none.

* Add a way to query host nodes for families
gaearon added a commit to gaearon/react that referenced this pull request Jun 19, 2019
* Fix existing test

This test included a change in variable name. It wasn't needed, and distracts from the actual thing being tested (the annotation).

* Reset state on edits to initial state argument

* Add a way to check whether there are hot updates

prepareUpdate() now returns null if there are none.

* Add a way to query host nodes for families
rickhanlonii pushed a commit to rickhanlonii/react that referenced this pull request Jun 25, 2019
* Fix existing test

This test included a change in variable name. It wasn't needed, and distracts from the actual thing being tested (the annotation).

* Reset state on edits to initial state argument

* Add a way to check whether there are hot updates

prepareUpdate() now returns null if there are none.

* Add a way to query host nodes for families
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