Skip to content

Commit 965cef0

Browse files
committed
Debug setState error in timeJump
1 parent 4cb18a9 commit 965cef0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/backend/controllers/timeJump.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ async function updateReactFiberTree(
7070
if (index !== null) {
7171
// Obtain the BOUND update method at the given index
7272
const classComponent = componentActionsRecord.getComponentByIndex(index);
73-
// Update component state
74-
await classComponent.setState(
75-
// prevState contains the states of the snapshots we are jumping FROM, not jumping TO
76-
(prevState) => state,
77-
);
73+
// This conditional avoids the error that occurs when classComponent is undefined
74+
if (classComponent !== undefined) {
75+
// Update component state
76+
await classComponent.setState(
77+
// prevState contains the states of the snapshots we are jumping FROM, not jumping TO
78+
(prevState) => state,
79+
);
80+
}
7881
// Iterate through new children after state has been set
7982
targetSnapshot.children.forEach((child) => updateReactFiberTree(child, circularComponentTable));
8083
return;

0 commit comments

Comments
 (0)