Skip to content

Flare: ensure discrete event flush is disabled during initial DOM mount #15701

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

Closed

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented May 21, 2019

When testing #15687 internally, we encountered some issues where the invariant in flushDiscreteUpdates fired during legit tests.

The reason for this was because ReactDOM sets properties and attributes on elements on initial mount, which can also fire events on the DOM. We don't want these events to flush discrete events, so we now set a flag for this that we enable before setting DOM properties and then disable after setting them.

Furthermore, we felt that the invariant was maybe too strong, so this has been downgraded to a warning in DEV.

@sizebot
Copy link

sizebot commented May 21, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: d7afe23...9da4c7f

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% +0.1% 850.88 KB 851.24 KB 193.9 KB 194.02 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 105.31 KB 105.31 KB 34.23 KB 34.25 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 108.49 KB 108.5 KB 35.25 KB 35.26 KB UMD_PROFILING
react-dom.development.js 0.0% +0.1% 845.2 KB 845.56 KB 192.34 KB 192.46 KB NODE_DEV
react-dom.production.min.js 0.0% 🔺+0.1% 105.31 KB 105.32 KB 33.64 KB 33.65 KB NODE_PROD
react-dom.profiling.min.js 0.0% +0.1% 108.67 KB 108.68 KB 34.5 KB 34.53 KB NODE_PROFILING
ReactDOM-dev.js 0.0% +0.1% 870.76 KB 871.17 KB 193.98 KB 194.11 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 354.54 KB 354.72 KB 65.63 KB 65.65 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% +0.1% 359.68 KB 359.85 KB 66.59 KB 66.63 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js 0.0% +0.1% 851.23 KB 851.59 KB 194.04 KB 194.17 KB UMD_DEV
react-dom-unstable-fire.production.min.js 0.0% 0.0% 105.33 KB 105.33 KB 34.24 KB 34.26 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js 0.0% 0.0% 108.51 KB 108.51 KB 35.26 KB 35.27 KB UMD_PROFILING
react-dom-unstable-fire.development.js 0.0% +0.1% 845.55 KB 845.91 KB 192.48 KB 192.6 KB NODE_DEV
react-dom-unstable-fire.production.min.js 0.0% 0.0% 105.32 KB 105.33 KB 33.65 KB 33.66 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js 0.0% +0.1% 108.68 KB 108.69 KB 34.51 KB 34.54 KB NODE_PROFILING
ReactFire-dev.js 0.0% +0.1% 869.97 KB 870.37 KB 193.93 KB 194.06 KB FB_WWW_DEV
ReactFire-prod.js 🔺+0.1% 🔺+0.1% 342.48 KB 342.65 KB 63.2 KB 63.23 KB FB_WWW_PROD
ReactFire-profiling.js 0.0% +0.1% 347.63 KB 347.79 KB 64.15 KB 64.19 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 57.24 KB 57.24 KB 15.75 KB 15.75 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.76 KB 60.76 KB 15.84 KB 15.85 KB UMD_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-server.browser.development.js 0.0% -0.0% 137.21 KB 137.21 KB 36.17 KB 36.17 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.2 KB 19.2 KB 7.23 KB 7.22 KB UMD_PROD
react-dom-server.browser.development.js 0.0% -0.0% 133.34 KB 133.34 KB 35.23 KB 35.23 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.12 KB 19.12 KB 7.22 KB 7.22 KB NODE_PROD
ReactDOMServer-dev.js 0.0% 0.0% 135.54 KB 135.54 KB 34.8 KB 34.8 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 47.98 KB 47.98 KB 11.03 KB 11.04 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% -0.0% 135.28 KB 135.28 KB 35.78 KB 35.78 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 19.98 KB 19.98 KB 7.53 KB 7.52 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.81 KB 3.81 KB 1.53 KB 1.54 KB UMD_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

Generated by 🚫 dangerJS

@acdlite
Copy link
Collaborator

acdlite commented May 21, 2019

Maybe we should just revert the warning entirely if it's causing problems? Until we can verify that this approach is correct, and write tests. If the point is to unblock the sync then we should change as little as possible about the current behavior.

@trueadm
Copy link
Contributor Author

trueadm commented May 21, 2019

@acdlite I've added a regression test that confirms the expected behaviour.

@trueadm
Copy link
Contributor Author

trueadm commented May 21, 2019

We will come back to this one in the future. Closing this in favour of #15702

@trueadm trueadm closed this May 21, 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