dillon1000/react
Commit
Browse files Capture React.startTransition errors and pass to reportError (#28111)
To make React.startTransition more consistent with the hook form of startTransition, we capture errors thrown by the scope function and pass them to the global reportError function. (This is also what we do as a default for onRecoverableError.) This is a breaking change because it means that errors inside of startTransition will no longer bubble up to the caller. You can still catch the error by putting a try/catch block inside of the scope function itself. We do the same for async actions to prevent "unhandled promise rejection" warnings. The motivation is to avoid a refactor hazard when changing from a sync to an async action, or from useTransition to startTransition.
Changed paths4 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react-reconciler/src/ReactFiberTransition.js ModifiedM packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js ModifiedM packages/react/src/ReactStartTransition.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…