MCPcopy Index your code
hub / github.com/react/react / readRecord

Function readRecord

packages/react-devtools-shared/src/hookNamesCache.js:30–49  ·  view source on GitHub ↗
(record: Thenable<T>)

Source from the content-addressed store, hash-verified

28
29const TIMEOUT = 30000;
30function readRecord<T>(record: Thenable<T>): T | null {
31 if (typeof React.use === 'function') {
32 try {
33 // eslint-disable-next-line react-hooks-published/rules-of-hooks
34 return React.use(record);
35 } catch (x) {
36 if (record.status === 'rejected') {
37 return null;
38 }
39 throw x;
40 }
41 }
42 if (record.status === 'fulfilled') {
43 return record.value;
44 } else if (record.status === 'rejected') {
45 return null;
46 } else {
47 throw record;
48 }
49}
50
51type LoadHookNamesFunction = (
52 hookLog: HooksTree,

Callers 2

loadHookNamesFunction · 0.70
index.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected