-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suspend in render, not in reducers (#56497)
This removes our current convention of throwing promises in reducers in favor of returning promises that can be consumed by `use` instead. This will help unblock some future improvements (batching, PPR) Reducers that would typically throw a promise now return their promise. This gets maintained by a mutable queue (initialized in hydrate) to ensure actions are processed in-order. The queue is also responsible for mutating state and passing it as an input to subsequent actions. This PR does not modify reducer behavior to keep changes minimal, but there's more cleanup that we can do in a follow-up PR to remove things that previously assumed reducers would be replayed. (I recommend reviewing with whitespace turned off) --------- Co-authored-by: Tim Neutkens <[email protected]>
- Loading branch information
1 parent
be61804
commit 85abc48
Showing
16 changed files
with
720 additions
and
566 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
28 changes: 0 additions & 28 deletions
28
packages/next/src/client/components/router-reducer/read-record-value.test.ts
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
packages/next/src/client/components/router-reducer/read-record-value.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.