validateSuspenseListChildren() — react Function Reference
Architecture documentation for the validateSuspenseListChildren() function in ReactChildFiber.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD edaa94ab_54b1_ee44_b663_b39c67e52cf5["validateSuspenseListChildren()"] 2cfec8e5_036b_ef3c_de46_566fc82c5729["ReactChildFiber.js"] edaa94ab_54b1_ee44_b663_b39c67e52cf5 -->|defined in| 2cfec8e5_036b_ef3c_de46_566fc82c5729 1db7a018_9937_932b_946b_6f674a413872["updateSuspenseListComponent()"] 1db7a018_9937_932b_946b_6f674a413872 -->|calls| edaa94ab_54b1_ee44_b663_b39c67e52cf5 6faa257c_5f4a_3bf6_e4aa_60f067e3c220["validateSuspenseListNestedChild()"] edaa94ab_54b1_ee44_b663_b39c67e52cf5 -->|calls| 6faa257c_5f4a_3bf6_e4aa_60f067e3c220 style edaa94ab_54b1_ee44_b663_b39c67e52cf5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactChildFiber.js lines 2183–2252
export function validateSuspenseListChildren(
children: mixed,
revealOrder: SuspenseListRevealOrder,
) {
if (__DEV__) {
if (
(revealOrder == null ||
revealOrder === 'forwards' ||
revealOrder === 'backwards' ||
revealOrder === 'unstable_legacy-backwards') &&
children !== undefined &&
children !== null &&
children !== false
) {
if (isArray(children)) {
for (let i = 0; i < children.length; i++) {
if (!validateSuspenseListNestedChild(children[i], i)) {
return;
}
}
} else {
const iteratorFn = getIteratorFn(children);
if (typeof iteratorFn === 'function') {
const childrenIterator = iteratorFn.call(children);
if (childrenIterator) {
let step = childrenIterator.next();
let i = 0;
for (; !step.done; step = childrenIterator.next()) {
if (!validateSuspenseListNestedChild(step.value, i)) {
return;
}
i++;
}
}
} else if (
enableAsyncIterableChildren &&
typeof (children: any)[ASYNC_ITERATOR] === 'function'
) {
// TODO: Technically we should warn for nested arrays inside the
// async iterable but it would require unwrapping the array.
// However, this mistake is not as easy to make so it's ok not to warn.
} else if (
enableAsyncIterableChildren &&
children.$$typeof === REACT_ELEMENT_TYPE &&
typeof children.type === 'function' &&
// $FlowFixMe
(Object.prototype.toString.call(children.type) ===
'[object GeneratorFunction]' ||
// $FlowFixMe
Object.prototype.toString.call(children.type) ===
'[object AsyncGeneratorFunction]')
) {
console.error(
'A generator Component was passed to a <SuspenseList revealOrder="%s" />. ' +
'This is not supported as a way to generate lists. Instead, pass an ' +
'iterable as the children.',
revealOrder,
);
} else {
console.error(
'A single row was passed to a <SuspenseList revealOrder="%s" />. ' +
'This is not useful since it needs multiple rows. ' +
'Did you mean to pass multiple children or an array?',
revealOrder,
);
}
}
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does validateSuspenseListChildren() do?
validateSuspenseListChildren() is a function in the react codebase, defined in packages/react-reconciler/src/ReactChildFiber.js.
Where is validateSuspenseListChildren() defined?
validateSuspenseListChildren() is defined in packages/react-reconciler/src/ReactChildFiber.js at line 2183.
What does validateSuspenseListChildren() call?
validateSuspenseListChildren() calls 1 function(s): validateSuspenseListNestedChild.
What calls validateSuspenseListChildren()?
validateSuspenseListChildren() is called by 1 function(s): updateSuspenseListComponent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free