Skip to content

Commit ebe18b5

Browse files
committed
Add extra invariants when bailing out on already progressed work
1 parent 78974ac commit ebe18b5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/renderers/shared/fiber/ReactFiberBeginWork.js

+11
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ function bailout(
216216
workInProgress,
217217
);
218218
if (workInProgress === progressedWork) {
219+
invariant(
220+
current === null ||
221+
current.child === null ||
222+
workInProgress.child !== current.child,
223+
'Expected child to be a work-in-progress child',
224+
);
219225
if (workInProgress.progressedPriority === renderPriority) {
220226
// We have progressed work that completed at this level. Because the
221227
// remaining priority (pendingWorkPriority) is less than the priority
@@ -246,6 +252,11 @@ function bailout(
246252
);
247253
resetToCurrent(current, workInProgress, renderPriority);
248254
}
255+
} else {
256+
invariant(
257+
current !== null && current.child === workInProgress.child,
258+
'Expected child to be the current child',
259+
);
249260
}
250261

251262
// Return null to skip the children and continue on the sibling. If

0 commit comments

Comments
 (0)