Skip to content

Commit

Permalink
Use fewer global variables in Hooks (#17480)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sebmarkbage authored Dec 3, 2019
1 parent d75323f commit f523b2e
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 114 deletions.
Loading

0 comments on commit f523b2e

Please sign in to comment.