GeezerVison is showing github.com — Add back disableSchedulerTimeoutInWorkLoop flag (#20482) · react/react@5687864
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.new.js +14-1Lines changed: 14 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,7 @@ import { | 31 | 31 | enableDebugTracing, | 32 | 32 | enableSchedulingProfiler, | 33 | 33 | enableScopeAPI, | | 34 | + disableSchedulerTimeoutInWorkLoop, | 34 | 35 | } from 'shared/ReactFeatureFlags'; | 35 | 36 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 36 | 37 | import invariant from 'shared/invariant'; | @@ -767,7 +768,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) { | 767 | 768 |
| 768 | 769 | // This is the entry point for every concurrent task, i.e. anything that | 769 | 770 | // goes through Scheduler. | 770 | | -function performConcurrentWorkOnRoot(root) { | | 771 | +function performConcurrentWorkOnRoot(root, didTimeout) { | 771 | 772 | if (enableProfilerTimer && enableProfilerNestedUpdatePhase) { | 772 | 773 | resetNestedUpdateFlag(); | 773 | 774 | } | @@ -811,6 +812,18 @@ function performConcurrentWorkOnRoot(root) { | 811 | 812 | return null; | 812 | 813 | } | 813 | 814 |
| | 815 | + // TODO: We only check `didTimeout` defensively, to account for a Scheduler | | 816 | + // bug we're still investigating. Once the bug in Scheduler is fixed, | | 817 | + // we can remove this, since we track expiration ourselves. | | 818 | + if (!disableSchedulerTimeoutInWorkLoop && didTimeout) { | | 819 | + // Something expired. Flush synchronously until there's no expired | | 820 | + // work left. | | 821 | + markRootExpired(root, lanes); | | 822 | + // This will schedule a synchronous callback. | | 823 | + ensureRootIsScheduled(root, now()); | | 824 | + return null; | | 825 | + } | | 826 | + | 814 | 827 | let exitStatus = renderRootConcurrent(root, lanes); | 815 | 828 |
| 816 | 829 | if ( | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.old.js +14-1Lines changed: 14 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,6 +33,7 @@ import { | 33 | 33 | enableSchedulingProfiler, | 34 | 34 | enableScopeAPI, | 35 | 35 | enableDoubleInvokingEffects, | | 36 | + disableSchedulerTimeoutInWorkLoop, | 36 | 37 | } from 'shared/ReactFeatureFlags'; | 37 | 38 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 38 | 39 | import invariant from 'shared/invariant'; | @@ -775,7 +776,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) { | 775 | 776 |
| 776 | 777 | // This is the entry point for every concurrent task, i.e. anything that | 777 | 778 | // goes through Scheduler. | 778 | | -function performConcurrentWorkOnRoot(root) { | | 779 | +function performConcurrentWorkOnRoot(root, didTimeout) { | 779 | 780 | if (enableProfilerTimer && enableProfilerNestedUpdatePhase) { | 780 | 781 | resetNestedUpdateFlag(); | 781 | 782 | } | @@ -819,6 +820,18 @@ function performConcurrentWorkOnRoot(root) { | 819 | 820 | return null; | 820 | 821 | } | 821 | 822 |
| | 823 | + // TODO: We only check `didTimeout` defensively, to account for a Scheduler | | 824 | + // bug we're still investigating. Once the bug in Scheduler is fixed, | | 825 | + // we can remove this, since we track expiration ourselves. | | 826 | + if (!disableSchedulerTimeoutInWorkLoop && didTimeout) { | | 827 | + // Something expired. Flush synchronously until there's no expired | | 828 | + // work left. | | 829 | + markRootExpired(root, lanes); | | 830 | + // This will schedule a synchronous callback. | | 831 | + ensureRootIsScheduled(root, now()); | | 832 | + return null; | | 833 | + } | | 834 | + | 822 | 835 | let exitStatus = renderRootConcurrent(root, lanes); | 823 | 836 |
| 824 | 837 | if ( | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/ReactFeatureFlags.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -141,3 +141,5 @@ export const enableDoubleInvokingEffects = false; | 141 | 141 | export const enableUseRefAccessWarning = false; | 142 | 142 |
| 143 | 143 | export const enableRecursiveCommitTraversal = false; | | 144 | + | | 145 | +export const disableSchedulerTimeoutInWorkLoop = false; |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-fb.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -56,6 +56,7 @@ export const enableDoubleInvokingEffects = false; | 56 | 56 | export const enableUseRefAccessWarning = false; | 57 | 57 |
| 58 | 58 | export const enableRecursiveCommitTraversal = false; | | 59 | +export const disableSchedulerTimeoutInWorkLoop = false; | 59 | 60 |
| 60 | 61 | // Flow magic to verify the exports of this file match the original version. | 61 | 62 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-oss.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = false; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = false; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = false; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = true; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.testing.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = false; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.testing.www.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ export const enableDoubleInvokingEffects = false; | 55 | 55 | export const enableUseRefAccessWarning = false; | 56 | 56 |
| 57 | 57 | export const enableRecursiveCommitTraversal = false; | | 58 | +export const disableSchedulerTimeoutInWorkLoop = false; | 58 | 59 |
| 59 | 60 | // Flow magic to verify the exports of this file match the original version. | 60 | 61 | // eslint-disable-next-line no-unused-vars | |
|