Skip to content

Commit 95bd7aa

Browse files
authored
Remove renderPhaseUpdates Map (#17625)
* Remove renderPhaseUpdates Map Follow up to #17484, which was reverted due to a bug found in www. * Failing test: Dropped updates When resetting render phase updates after a throw, we should only clear the pending queue of hooks that were already processed. * Fix non-render-phase updates being dropped Detects if a queue has been processed by whether the hook was cloned. If we change the implementation to an array instead of a list, we'll need some other mechanism to determine whether the hook was processed. * Regression test: startTransition in render phase useTransition uses the state hook as part of its implementation, so we need to fork it in the dispatcher used for re-renders, too.
1 parent 29b4d07 commit 95bd7aa

File tree

4 files changed

+563
-147
lines changed

4 files changed

+563
-147
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ import {
137137
calculateChangedBits,
138138
scheduleWorkOnParentPath,
139139
} from './ReactFiberNewContext';
140-
import {resetHooks, renderWithHooks, bailoutHooks} from './ReactFiberHooks';
140+
import {renderWithHooks, bailoutHooks} from './ReactFiberHooks';
141141
import {stopProfilerTimerIfRunning} from './ReactProfilerTimer';
142142
import {
143143
getMaskedContext,
@@ -1407,7 +1407,8 @@ function mountIndeterminateComponent(
14071407
workInProgress.tag = ClassComponent;
14081408

14091409
// Throw out any hooks that were used.
1410-
resetHooks();
1410+
workInProgress.memoizedState = null;
1411+
workInProgress.updateQueue = null;
14111412

14121413
// Push context providers early to prevent context stack mismatches.
14131414
// During mounting we don't know the child context yet as the instance doesn't exist.

0 commit comments

Comments
 (0)