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 — Delete immediateQueueCallbackNode (#20980) · react/react@754e307

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-reconciler/src
    • ReactFiberWorkLoop.new.js
    • ReactFiberWorkLoop.old.js
    • SchedulerWithReactIntegration.new.js
    • SchedulerWithReactIntegration.old.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
getCurrentEventPriority,
9090
supportsMicrotasks,
9191
errorHydratingContainer,
92+
scheduleMicrotask,
9293
} from './ReactFiberHostConfig';
9394

9495
import {
@@ -696,6 +697,13 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
696697
// Special case: Sync React callbacks are scheduled on a special
697698
// internal queue
698699
scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
700+
if (supportsMicrotasks) {
701+
// Flush the queue in a microtask.
702+
scheduleMicrotask(flushSyncCallbackQueue);
703+
} else {
704+
// Flush the queue in an Immediate task.
705+
scheduleCallback(ImmediateSchedulerPriority, flushSyncCallbackQueue);
706+
}
699707
newCallbackNode = null;
700708
} else if (newCallbackPriority === SyncBatchedLanePriority) {
701709
newCallbackNode = scheduleCallback(
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
getCurrentEventPriority,
9090
supportsMicrotasks,
9191
errorHydratingContainer,
92+
scheduleMicrotask,
9293
} from './ReactFiberHostConfig';
9394

9495
import {
@@ -696,6 +697,13 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
696697
// Special case: Sync React callbacks are scheduled on a special
697698
// internal queue
698699
scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
700+
if (supportsMicrotasks) {
701+
// Flush the queue in a microtask.
702+
scheduleMicrotask(flushSyncCallbackQueue);
703+
} else {
704+
// Flush the queue in an Immediate task.
705+
scheduleCallback(ImmediateSchedulerPriority, flushSyncCallbackQueue);
706+
}
699707
newCallbackNode = null;
700708
} else if (newCallbackPriority === SyncBatchedLanePriority) {
701709
newCallbackNode = scheduleCallback(
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/SchedulerWithReactIntegration.new.js
+1-24Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
getCurrentUpdateLanePriority,
2121
setCurrentUpdateLanePriority,
2222
} from './ReactFiberLane.new';
23-
import {scheduleMicrotask, supportsMicrotasks} from './ReactFiberHostConfig';
2423

2524
const {
2625
unstable_scheduleCallback: Scheduler_scheduleCallback,
@@ -71,7 +70,6 @@ export const requestPaint =
7170
Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : () => {};
7271

7372
let syncQueue: Array<SchedulerCallback> | null = null;
74-
let immediateQueueCallbackNode: mixed | null = null;
7573
let isFlushingSyncQueue: boolean = false;
7674
const initialTimeMs: number = Scheduler_now();
7775

@@ -133,19 +131,6 @@ export function scheduleSyncCallback(callback: SchedulerCallback) {
133131
// the next tick, or earlier if something calls `flushSyncCallbackQueue`.
134132
if (syncQueue === null) {
135133
syncQueue = [callback];
136-
137-
// TODO: Figure out how to remove this It's only here as a last resort if we
138-
// forget to explicitly flush.
139-
if (supportsMicrotasks) {
140-
// Flush the queue in a microtask.
141-
scheduleMicrotask(flushSyncCallbackQueueImpl);
142-
} else {
143-
// Flush the queue in the next tick.
144-
immediateQueueCallbackNode = Scheduler_scheduleCallback(
145-
Scheduler_ImmediatePriority,
146-
flushSyncCallbackQueueImpl,
147-
);
148-
}
149134
} else {
150135
// Push onto existing queue. Don't need to schedule a callback because
151136
// we already scheduled one when we created the queue.
@@ -158,15 +143,6 @@ export function cancelCallback(callbackNode: mixed) {
158143
}
159144

160145
export function flushSyncCallbackQueue() {
161-
if (immediateQueueCallbackNode !== null) {
162-
const node = immediateQueueCallbackNode;
163-
immediateQueueCallbackNode = null;
164-
Scheduler_cancelCallback(node);
165-
}
166-
flushSyncCallbackQueueImpl();
167-
}
168-
169-
function flushSyncCallbackQueueImpl() {
170146
if (!isFlushingSyncQueue && syncQueue !== null) {
171147
// Prevent re-entrancy.
172148
isFlushingSyncQueue = true;
@@ -199,4 +175,5 @@ function flushSyncCallbackQueueImpl() {
199175
isFlushingSyncQueue = false;
200176
}
201177
}
178+
return null;
202179
}
Collapse file

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

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/SchedulerWithReactIntegration.old.js
+1-24Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
getCurrentUpdateLanePriority,
2121
setCurrentUpdateLanePriority,
2222
} from './ReactFiberLane.old';
23-
import {scheduleMicrotask, supportsMicrotasks} from './ReactFiberHostConfig';
2423

2524
const {
2625
unstable_scheduleCallback: Scheduler_scheduleCallback,
@@ -71,7 +70,6 @@ export const requestPaint =
7170
Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : () => {};
7271

7372
let syncQueue: Array<SchedulerCallback> | null = null;
74-
let immediateQueueCallbackNode: mixed | null = null;
7573
let isFlushingSyncQueue: boolean = false;
7674
const initialTimeMs: number = Scheduler_now();
7775

@@ -133,19 +131,6 @@ export function scheduleSyncCallback(callback: SchedulerCallback) {
133131
// the next tick, or earlier if something calls `flushSyncCallbackQueue`.
134132
if (syncQueue === null) {
135133
syncQueue = [callback];
136-
137-
// TODO: Figure out how to remove this It's only here as a last resort if we
138-
// forget to explicitly flush.
139-
if (supportsMicrotasks) {
140-
// Flush the queue in a microtask.
141-
scheduleMicrotask(flushSyncCallbackQueueImpl);
142-
} else {
143-
// Flush the queue in the next tick.
144-
immediateQueueCallbackNode = Scheduler_scheduleCallback(
145-
Scheduler_ImmediatePriority,
146-
flushSyncCallbackQueueImpl,
147-
);
148-
}
149134
} else {
150135
// Push onto existing queue. Don't need to schedule a callback because
151136
// we already scheduled one when we created the queue.
@@ -158,15 +143,6 @@ export function cancelCallback(callbackNode: mixed) {
158143
}
159144

160145
export function flushSyncCallbackQueue() {
161-
if (immediateQueueCallbackNode !== null) {
162-
const node = immediateQueueCallbackNode;
163-
immediateQueueCallbackNode = null;
164-
Scheduler_cancelCallback(node);
165-
}
166-
flushSyncCallbackQueueImpl();
167-
}
168-
169-
function flushSyncCallbackQueueImpl() {
170146
if (!isFlushingSyncQueue && syncQueue !== null) {
171147
// Prevent re-entrancy.
172148
isFlushingSyncQueue = true;
@@ -199,4 +175,5 @@ function flushSyncCallbackQueueImpl() {
199175
isFlushingSyncQueue = false;
200176
}
201177
}
178+
return null;
202179
}

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.