dillon1000/react

Commit

Use fewer global variables in Hooks (#17480)

* We don't need the global state for this

* Move componentUpdateQueue and sideEffectTag out of global state

* Move firstWorkInProgressHook off global state

* Move remainingExpirationTime off global state

* Reset fiber to its current state if it throws

* Move rerender error check to avoid global state

This means that it's harder to find it since it's not in the dispatch
function's stack but we can add a DEV only one for that if we really
need it. Alternatively, we can check it in against the renderUpdates queue.

* Move next___Hook out of global state

* Assert that currentlyRenderingFiber is always set

When accessed, this should always be set. This could enforced by storing
this on the dispatcher for example.

* Add another test just to be safe
Browse files
Changed paths3 files
First-parent comparison
M packages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react-reconciler/src/ReactFiberThrow.js ModifiedM packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…