MCPcopy Create free account
hub / github.com/react/react / getSuspendedThenable

Function getSuspendedThenable

packages/react-reconciler/src/ReactFiberThenable.js:323–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

321let suspendedThenable: Thenable<any> | null = null;
322let needsToResetSuspendedThenableDEV = false;
323export function getSuspendedThenable(): Thenable<mixed> {
324 // This is called right after `use` suspends by throwing an exception. `use`
325 // throws an opaque value instead of the thenable itself so that it can't be
326 // caught in userspace. Then the work loop accesses the actual thenable using
327 // this function.
328 if (suspendedThenable === null) {
329 throw new Error(
330 'Expected a suspended thenable. This is a bug in React. Please file ' +
331 'an issue.',
332 );
333 }
334 const thenable = suspendedThenable;
335 suspendedThenable = null;
336 if (__DEV__) {
337 needsToResetSuspendedThenableDEV = false;
338 }
339 return thenable;
340}
341
342export function checkIfUseWrappedInTryCatch(): boolean {
343 if (__DEV__) {

Callers 1

handleThrowFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected