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 — Add queue microtask to host configs (#20668) · react/react@aa736a0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-art/src
      • ReactARTHostConfig.js
    • react-dom/src/client
      • ReactDOMHostConfig.js
    • react-native-renderer/src
      • ReactFabricHostConfig.js
      • ReactNativeHostConfig.js
    • react-noop-renderer/src
      • createReactNoop.js
    • react-reconciler/src/forks
      • ReactFiberHostConfig.custom.js
    • react-test-renderer/src
      • ReactTestHostConfig.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-art/src/ReactARTHostConfig.js‎

Copy file name to clipboardExpand all lines: packages/react-art/src/ReactARTHostConfig.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ export function getChildHostContext() {
330330
export const scheduleTimeout = setTimeout;
331331
export const cancelTimeout = clearTimeout;
332332
export const noTimeout = -1;
333+
export function queueMicrotask(callback: Function) {
334+
invariant(false, 'Not implemented.');
335+
}
333336

334337
export function shouldSetTextContent(type, props) {
335338
return (
Collapse file

‎packages/react-dom/src/client/ReactDOMHostConfig.js‎

Copy file name to clipboardExpand all lines: packages/react-dom/src/client/ReactDOMHostConfig.js
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,21 @@ export const scheduleTimeout: any =
384384
export const cancelTimeout: any =
385385
typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
386386
export const noTimeout = -1;
387+
export const queueMicrotask: any =
388+
typeof global.queueMicrotask === 'function'
389+
? global.queueMicrotask
390+
: typeof Promise !== 'undefined'
391+
? callback =>
392+
Promise.resolve(null)
393+
.then(callback)
394+
.catch(handleErrorInNextTick)
395+
: scheduleTimeout;
396+
397+
function handleErrorInNextTick(error) {
398+
setTimeout(() => {
399+
throw error;
400+
});
401+
}
387402

388403
// -------------------
389404
// Mutation
Collapse file

‎packages/react-native-renderer/src/ReactFabricHostConfig.js‎

Copy file name to clipboardExpand all lines: packages/react-native-renderer/src/ReactFabricHostConfig.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ export const warnsIfNotActing = false;
348348
export const scheduleTimeout = setTimeout;
349349
export const cancelTimeout = clearTimeout;
350350
export const noTimeout = -1;
351+
export function queueMicrotask(callback: Function) {
352+
invariant(false, 'Not implemented.');
353+
}
351354

352355
// -------------------
353356
// Persistence
Collapse file

‎packages/react-native-renderer/src/ReactNativeHostConfig.js‎

Copy file name to clipboardExpand all lines: packages/react-native-renderer/src/ReactNativeHostConfig.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ export const warnsIfNotActing = true;
247247
export const scheduleTimeout = setTimeout;
248248
export const cancelTimeout = clearTimeout;
249249
export const noTimeout = -1;
250+
export function queueMicrotask(callback: Function) {
251+
invariant(false, 'Not implemented.');
252+
}
250253

251254
export function shouldSetTextContent(type: string, props: Props): boolean {
252255
// TODO (bvaughn) Revisit this decision.
Collapse file

‎packages/react-noop-renderer/src/createReactNoop.js‎

Copy file name to clipboardExpand all lines: packages/react-noop-renderer/src/createReactNoop.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,19 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
371371
scheduleTimeout: setTimeout,
372372
cancelTimeout: clearTimeout,
373373
noTimeout: -1,
374+
queueMicrotask:
375+
typeof queueMicrotask === 'function'
376+
? queueMicrotask
377+
: typeof Promise !== 'undefined'
378+
? callback =>
379+
Promise.resolve(null)
380+
.then(callback)
381+
.catch(error => {
382+
setTimeout(() => {
383+
throw error;
384+
});
385+
})
386+
: setTimeout,
374387

375388
prepareForCommit(): null | Object {
376389
return null;
Collapse file

‎packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const shouldSetTextContent = $$$hostConfig.shouldSetTextContent;
5454
export const createTextInstance = $$$hostConfig.createTextInstance;
5555
export const scheduleTimeout = $$$hostConfig.scheduleTimeout;
5656
export const cancelTimeout = $$$hostConfig.cancelTimeout;
57+
export const queueMicrotask = $$$hostConfig.queueMicrotask;
5758
export const noTimeout = $$$hostConfig.noTimeout;
5859
export const now = $$$hostConfig.now;
5960
export const isPrimaryRenderer = $$$hostConfig.isPrimaryRenderer;
Collapse file

‎packages/react-test-renderer/src/ReactTestHostConfig.js‎

Copy file name to clipboardExpand all lines: packages/react-test-renderer/src/ReactTestHostConfig.js
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ export const warnsIfNotActing = true;
220220

221221
export const scheduleTimeout = setTimeout;
222222
export const cancelTimeout = clearTimeout;
223+
export const queueMicrotask =
224+
typeof global.queueMicrotask === 'function'
225+
? global.queueMicrotask
226+
: typeof Promise !== 'undefined'
227+
? (callback: Function) =>
228+
Promise.resolve(null)
229+
.then(callback)
230+
.catch(handleErrorInNextTick)
231+
: scheduleTimeout;
232+
233+
function handleErrorInNextTick(error) {
234+
setTimeout(() => {
235+
throw error;
236+
});
237+
}
223238
export const noTimeout = -1;
224239

225240
// -------------------

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.