Skip to content

Commit

Permalink
Check if there's a chunk initializing
Browse files Browse the repository at this point in the history
Console values don't have initializing chunks so no parent.
  • Loading branch information
sebmarkbage committed Dec 11, 2024
1 parent b9709b0 commit f468d08
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ type InitializationHandler = {
errored: boolean,
};
let initializingHandler: null | InitializationHandler = null;
let initializingChunk: BlockedChunk<any> = (null: any);
let initializingChunk: null | BlockedChunk<any> = null;

function initializeModelChunk<T>(chunk: ResolvedModelChunk<T>): void {
const prevHandler = initializingHandler;
Expand Down Expand Up @@ -1239,7 +1239,7 @@ function getOutlinedModel<T>(
const id = parseInt(path[0], 16);
const chunk = getChunk(response, id);
if (enableProfilerTimer && enableComponentPerformanceTrack) {
if (isArray(initializingChunk._children)) {
if (initializingChunk !== null && isArray(initializingChunk._children)) {
initializingChunk._children.push(chunk);
}
}
Expand Down Expand Up @@ -1393,7 +1393,10 @@ function parseModelString(
const id = parseInt(value.slice(2), 16);
const chunk = getChunk(response, id);
if (enableProfilerTimer && enableComponentPerformanceTrack) {
if (isArray(initializingChunk._children)) {
if (
initializingChunk !== null &&
isArray(initializingChunk._children)
) {
initializingChunk._children.push(chunk);
}
}
Expand All @@ -1410,7 +1413,10 @@ function parseModelString(
const id = parseInt(value.slice(2), 16);
const chunk = getChunk(response, id);
if (enableProfilerTimer && enableComponentPerformanceTrack) {
if (isArray(initializingChunk._children)) {
if (
initializingChunk !== null &&
isArray(initializingChunk._children)
) {
initializingChunk._children.push(chunk);
}
}
Expand Down

0 comments on commit f468d08

Please sign in to comment.