Skip to content

Commit 735877d

Browse files
committed
Convert invariant to warning
1 parent 2c7a2eb commit 735877d

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,15 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
728728
if (__DEV__) {
729729
// If we're going to re-use an existing task, it needs to exist.
730730
// Assume that discrete update microtasks are non-cancellable and null.
731-
invariant(
732-
existingCallbackNode != null ||
733-
newCallbackPriority === InputDiscreteLanePriority,
734-
'Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.',
735-
);
731+
// TODO: Temporary until we confirm this warning is not fired.
732+
if (
733+
existingCallbackNode == null &&
734+
existingCallbackPriority !== InputDiscreteLanePriority
735+
) {
736+
console.error(
737+
'Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.',
738+
);
739+
}
736740
}
737741
// The priority hasn't changed. We can reuse the existing task. Exit.
738742
return;

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,15 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
710710
if (__DEV__) {
711711
// If we're going to re-use an existing task, it needs to exist.
712712
// Assume that discrete update microtasks are non-cancellable and null.
713-
invariant(
714-
existingCallbackNode != null ||
715-
newCallbackPriority === InputDiscreteLanePriority,
716-
'Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.',
717-
);
713+
// TODO: Temporary until we confirm this warning is not fired.
714+
if (
715+
existingCallbackNode == null &&
716+
existingCallbackPriority !== InputDiscreteLanePriority
717+
) {
718+
console.error(
719+
'Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.',
720+
);
721+
}
718722
}
719723
// The priority hasn't changed. We can reuse the existing task. Exit.
720724
return;

0 commit comments

Comments
 (0)