Add fix for potential hydration mismatch errors #4675
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This re-wires aborting through the system which fixes #4674
I'm not particularly happy that aborting is required to fix this error, i think aborting should be an optional add on, but it does sort of makes sense that aborting fixes it because it prevents 'old' results from being hydrated with 'new props' which may be possible, which is otherwise actually very hard to avoid with the way that our hydration works (because both the hydrateRoot and the hydrateRoot.unmount have to be asynchronously done, and adding a check would require serializing all the props and checking that they are the same...or somthing like this, sort of guessing)
So, anyways, aborting allows the old results to be shot down before trying to appear in the UI
fixes #4674