GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bailout in sync task if work is not sync (#20813) · react/react@e2fd460

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-dom/src/events/plugins/__tests__
      • SimpleEventPlugin-test.js
    • react-reconciler/src
      • ReactFiberWorkLoop.new.js
      • ReactFiberWorkLoop.old.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ describe('SimpleEventPlugin', function() {
477477
// At the end, both counters should equal the total number of clicks
478478
expect(Scheduler).toHaveYielded([
479479
'High-pri count: 8, Low-pri count: 0',
480-
481-
// TODO: with cancellation, this required another flush?
480+
]);
481+
expect(Scheduler).toFlushAndYield([
482482
'High-pri count: 8, Low-pri count: 8',
483483
]);
484484
} else {
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,20 @@ function performSyncWorkOnRoot(root) {
10281028
exitStatus = renderRootSync(root, lanes);
10291029
} else {
10301030
lanes = getNextLanes(root, NoLanes);
1031+
// Because we don't cancel synchronous tasks, sometimes more than one
1032+
// synchronous task ends up being scheduled. This is an artifact of the fact
1033+
// that we have two different lanes that schedule sync tasks: discrete and
1034+
// sync. If we had only one, then (I believe) this extra check wouldn't be
1035+
// necessary, because there's nothing higher priority than sync that would
1036+
// cause us to cancel it.
1037+
// TODO: Merge InputDiscreteLanePriority with SyncLanePriority, then delete
1038+
// this bailout.
1039+
if (supportsMicrotasks) {
1040+
const nextLanesPriority = returnNextLanesPriority();
1041+
if (nextLanesPriority < InputDiscreteLanePriority) {
1042+
return null;
1043+
}
1044+
}
10311045
exitStatus = renderRootSync(root, lanes);
10321046
}
10331047

Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,20 @@ function performSyncWorkOnRoot(root) {
10281028
exitStatus = renderRootSync(root, lanes);
10291029
} else {
10301030
lanes = getNextLanes(root, NoLanes);
1031+
// Because we don't cancel synchronous tasks, sometimes more than one
1032+
// synchronous task ends up being scheduled. This is an artifact of the fact
1033+
// that we have two different lanes that schedule sync tasks: discrete and
1034+
// sync. If we had only one, then (I believe) this extra check wouldn't be
1035+
// necessary, because there's nothing higher priority than sync that would
1036+
// cause us to cancel it.
1037+
// TODO: Merge InputDiscreteLanePriority with SyncLanePriority, then delete
1038+
// this bailout.
1039+
if (supportsMicrotasks) {
1040+
const nextLanesPriority = returnNextLanesPriority();
1041+
if (nextLanesPriority < InputDiscreteLanePriority) {
1042+
return null;
1043+
}
1044+
}
10311045
exitStatus = renderRootSync(root, lanes);
10321046
}
10331047

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.