Repository navigation
Conversation
React 19 types no longer declare `ReactDOM.render` or `unmountComponentAtNode`, so type the React 16/17 code path locally. Node 24 ships a read-only `Symbol.dispose`, so only polyfill it when missing.
Since React 19.1, effects can run in a later task than their commit, so code that subscribes in `useEffect` was not yet subscribed when `await render()` resolved.
Member
|
Thank you for the PR and bringing this to my attention! We'll need to also fix this for Closing this here. Thank you again! |
Member
|
I'm cherry-picking your "version bump" commit to #19 so you should end up as a contributor, too :) |
phryneas
added a commit
that referenced
this pull request
Oct 27, 2026
…xt` promises resolve after effects are run (#18) As reported in #17, since React 19.1, passive effects (useEffect, and the subscription in useSyncExternalStore) can run in a later task than their commit. That means that with the current approach, `render/rerender` or even `takeNext` could trigger before all effects for that render had finished processing. This switches over to `onPostCommit`, an api that is not part of the official React types, but has been around stable since React 18, based on [this React RFC](https://github.com/reactjs/rfcs/pull/139/changes) and implemented in react/react#17910. React 16.8+ and 17 retain existing behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Since React 19.1, passive effects (
useEffect, and the subscription inuseSyncExternalStore) can run in a later task than their commit.await render()used to resolve after effects had run. Now it can resolve before, so a test that triggers an update straight after rendering fires it before the component has subscribed. 14 tests in this repo failed this way after upgrading to React 19.3.1.Change
renderandrerenderfromcreateRenderStream(and sorenderHookToSnapshotStream) now resolve only after the effects of that commit have run. The internalWrapperhas auseEffect, and parent effects run after child effects. The existing tests pass unchanged.@types/react19. The React 16/17 legacy root is still supported at runtime and is now typed locally, because React 19 types removedReactDOM.render.Symbol.disposetest polyfill no longer crashes on Node 24, where the symbol is built in and read-only.renderWithoutActis unchanged, because it never waited for the render either.Testing
yarn validatepasses on React 19.3.1. The test suite also passes on React 19.0.0 and 18.3.1.