flattenUnusedSegments() — react Function Reference
Architecture documentation for the flattenUnusedSegments() function in code-path-segment.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3f78bfce_0dd7_08fe_731e_35240fc9240b["flattenUnusedSegments()"] 94915e97_e9c3_c422_6269_4bbf858b3cf3["CodePathSegment"] 3f78bfce_0dd7_08fe_731e_35240fc9240b -->|defined in| 94915e97_e9c3_c422_6269_4bbf858b3cf3 41574e9a_279d_8634_73bc_065ceb2fdbd5["newNext()"] 41574e9a_279d_8634_73bc_065ceb2fdbd5 -->|calls| 3f78bfce_0dd7_08fe_731e_35240fc9240b 6c672222_212c_f636_461c_cc6d37bc9347["newUnreachable()"] 6c672222_212c_f636_461c_cc6d37bc9347 -->|calls| 3f78bfce_0dd7_08fe_731e_35240fc9240b style 3f78bfce_0dd7_08fe_731e_35240fc9240b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js lines 193–222
static flattenUnusedSegments(segments) {
const done = Object.create(null);
const retv = [];
for (let i = 0; i < segments.length; ++i) {
const segment = segments[i];
// Ignores duplicated.
if (done[segment.id]) {
continue;
}
// Use previous segments if unused.
if (!segment.internal.used) {
for (let j = 0; j < segment.allPrevSegments.length; ++j) {
const prevSegment = segment.allPrevSegments[j];
if (!done[prevSegment.id]) {
done[prevSegment.id] = true;
retv.push(prevSegment);
}
}
} else {
done[segment.id] = true;
retv.push(segment);
}
}
return retv;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does flattenUnusedSegments() do?
flattenUnusedSegments() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js.
Where is flattenUnusedSegments() defined?
flattenUnusedSegments() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js at line 193.
What calls flattenUnusedSegments()?
flattenUnusedSegments() is called by 2 function(s): newNext, newUnreachable.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free