dillon1000/react
Commit
Browse files Warn if addTransitionType is called when there are no pending Actions (#32793)
Stacked on #32792. It's tricky to associate a specific `addTransitionType` call to a specific `startTransition` call because we don't have `AsyncContext` in browsers yet. However, we can keep track if there are any async transitions running at all, and if not, warn. This should cover most cases. This also errors when inside a React render which might be a legit way to associate a Transition Type to a specific render (e.g. based on props changing) but we want to be a more conservative about allowing that yet. If we wanted to support calling it in render, we might want to set which Transition object is currently rendering but it's still tricky if the render has `async function` components. So it might at least be restricted to sync components (like Hooks).
Changed paths4 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react/src/ReactSharedInternalsClient.js ModifiedM packages/react/src/ReactStartTransition.js ModifiedM packages/react/src/ReactTransitionType.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…