Fire change events for changes made to inputs before hydration #12955
Labels
Component: DOM
Resolution: Stale
Automatically closed due to inactivity
Type: Enhancement
Type: Needs Investigation
Currently when hydrating server-rendered markup we ignore changes the user makes before hydration. We also don't reset their changes once hydration finishes. The motivation there was likely to avoid losing user input. See this test:
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMServerIntegrationForms-test.js#L543-L552
The problem with that is that it assumes the value will continue to be changed after hydration completes (e.g., a user keeps typing). If they don't, then the DOM and React will be out of sync.
We should try to detect if there have been any changes made to an input when hydrating, and if so dispatch a change event so that the component is notified of the new value.
See #12939 for some more discussion.
The text was updated successfully, but these errors were encountered: