readText() — react Function Reference
Architecture documentation for the readText() function in ReactWrongReturnPointer-test.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 897fae0f_a641_32dd_82be_786629f3b466["readText()"] 008cb6af_1523_1e04_cd6e_1a1af2a946e7["ReactWrongReturnPointer-test.js"] 897fae0f_a641_32dd_82be_786629f3b466 -->|defined in| 008cb6af_1523_1e04_cd6e_1a1af2a946e7 74854ebf_8992_adbb_fd33_444ba85f4e92["AsyncText()"] 74854ebf_8992_adbb_fd33_444ba85f4e92 -->|calls| 897fae0f_a641_32dd_82be_786629f3b466 style 897fae0f_a641_32dd_82be_786629f3b466 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js lines 91–127
function readText(text) {
const textCache = getCacheForType(createTextCache);
const record = textCache.data.get(text);
if (record !== undefined) {
switch (record.status) {
case 'pending':
Scheduler.log(`Suspend! [${text}]`);
throw record.value;
case 'rejected':
Scheduler.log(`Error! [${text}]`);
throw record.value;
case 'resolved':
return textCache.version;
}
} else {
Scheduler.log(`Suspend! [${text}]`);
const thenable = {
pings: [],
then(resolve) {
if (newRecord.status === 'pending') {
thenable.pings.push(resolve);
} else {
Promise.resolve().then(() => resolve(newRecord.value));
}
},
};
const newRecord = {
status: 'pending',
value: thenable,
};
textCache.data.set(text, newRecord);
throw thenable;
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does readText() do?
readText() is a function in the react codebase, defined in packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js.
Where is readText() defined?
readText() is defined in packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js at line 91.
What calls readText()?
readText() is called by 1 function(s): AsyncText.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free