Skip to content

Commit caceeca

Browse files
committed
Add missing else
1 parent baf12b8 commit caceeca

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

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

+25-25
Original file line numberDiff line numberDiff line change
@@ -209,33 +209,33 @@ function flushSyncCallbackQueueImpl() {
209209
setCurrentUpdateLanePriority(previousLanePriority);
210210
isFlushingSyncQueue = false;
211211
}
212-
}
213-
214-
try {
215-
const isSync = true;
216-
const queue = syncQueue;
217-
runWithPriority(ImmediatePriority, () => {
218-
for (; i < queue.length; i++) {
219-
let callback = queue[i];
220-
do {
221-
callback = callback(isSync);
222-
} while (callback !== null);
212+
} else {
213+
try {
214+
const isSync = true;
215+
const queue = syncQueue;
216+
runWithPriority(ImmediatePriority, () => {
217+
for (; i < queue.length; i++) {
218+
let callback = queue[i];
219+
do {
220+
callback = callback(isSync);
221+
} while (callback !== null);
222+
}
223+
});
224+
syncQueue = null;
225+
} catch (error) {
226+
// If something throws, leave the remaining callbacks on the queue.
227+
if (syncQueue !== null) {
228+
syncQueue = syncQueue.slice(i + 1);
223229
}
224-
});
225-
syncQueue = null;
226-
} catch (error) {
227-
// If something throws, leave the remaining callbacks on the queue.
228-
if (syncQueue !== null) {
229-
syncQueue = syncQueue.slice(i + 1);
230+
// Resume flushing in the next tick
231+
Scheduler_scheduleCallback(
232+
Scheduler_ImmediatePriority,
233+
flushSyncCallbackQueue,
234+
);
235+
throw error;
236+
} finally {
237+
isFlushingSyncQueue = false;
230238
}
231-
// Resume flushing in the next tick
232-
Scheduler_scheduleCallback(
233-
Scheduler_ImmediatePriority,
234-
flushSyncCallbackQueue,
235-
);
236-
throw error;
237-
} finally {
238-
isFlushingSyncQueue = false;
239239
}
240240
}
241241
}

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

+25-25
Original file line numberDiff line numberDiff line change
@@ -209,33 +209,33 @@ function flushSyncCallbackQueueImpl() {
209209
setCurrentUpdateLanePriority(previousLanePriority);
210210
isFlushingSyncQueue = false;
211211
}
212-
}
213-
214-
try {
215-
const isSync = true;
216-
const queue = syncQueue;
217-
runWithPriority(ImmediatePriority, () => {
218-
for (; i < queue.length; i++) {
219-
let callback = queue[i];
220-
do {
221-
callback = callback(isSync);
222-
} while (callback !== null);
212+
} else {
213+
try {
214+
const isSync = true;
215+
const queue = syncQueue;
216+
runWithPriority(ImmediatePriority, () => {
217+
for (; i < queue.length; i++) {
218+
let callback = queue[i];
219+
do {
220+
callback = callback(isSync);
221+
} while (callback !== null);
222+
}
223+
});
224+
syncQueue = null;
225+
} catch (error) {
226+
// If something throws, leave the remaining callbacks on the queue.
227+
if (syncQueue !== null) {
228+
syncQueue = syncQueue.slice(i + 1);
223229
}
224-
});
225-
syncQueue = null;
226-
} catch (error) {
227-
// If something throws, leave the remaining callbacks on the queue.
228-
if (syncQueue !== null) {
229-
syncQueue = syncQueue.slice(i + 1);
230+
// Resume flushing in the next tick
231+
Scheduler_scheduleCallback(
232+
Scheduler_ImmediatePriority,
233+
flushSyncCallbackQueue,
234+
);
235+
throw error;
236+
} finally {
237+
isFlushingSyncQueue = false;
230238
}
231-
// Resume flushing in the next tick
232-
Scheduler_scheduleCallback(
233-
Scheduler_ImmediatePriority,
234-
flushSyncCallbackQueue,
235-
);
236-
throw error;
237-
} finally {
238-
isFlushingSyncQueue = false;
239239
}
240240
}
241241
}

0 commit comments

Comments
 (0)