Skip to content

Commit 2e576d3

Browse files
RobbyTiptonfscgoldenjoeeparkdavidkim7773khobread
committed
Cleaned up code before merging with dev50.
Co-authored-by: Chris LeBrett <[email protected]> Co-authored-by: Robby Tipton <[email protected]> Co-authored-by: Joseph Park <[email protected]> Co-authored-by: David Kim <[email protected]> Co-authored-by: Kevin HoEun Lee <[email protected]>
1 parent 62f17a9 commit 2e576d3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/backend/linkFiber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ function updateSnapShotTree(snap: Snapshot, mode: Mode): void {
134134
// Clears circular component table
135135
circularComponentTable.clear();
136136
// creates snapshot that is a tree based on properties in fiberRoot object
137+
componentActionsRecord.clear();
137138
snap.tree = createTree(current);
138139
}
139140
// sends the updated tree back

src/backend/masterState.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ import {
1515
// Information on these components include ComponentData as well as state
1616
// For class components, there will be one "component" for each snapshot
1717
// For functional components that utilize Hooks, there will be one "component" for each setter/getter every time we have a new snapshot
18-
const componentActionsRecord: HookStates = [];
18+
let componentActionsRecord: HookStates = [];
1919
let index = 0;
2020

2121
export default {
22+
clear: () => {
23+
componentActionsRecord = [];
24+
index = 0;
25+
},
2226
// adds new component to ComponentActionsRecord
2327
saveNew: (state, component, name): number => {
2428
componentActionsRecord[index] = { state, component, name };
2529
index++;
2630

27-
for (let i = 0; i < componentActionsRecord.length - 2; i++) {
28-
if (componentActionsRecord[i].name === name) {
29-
componentActionsRecord[i] = { state, component, name };
30-
}
31-
}
32-
3331
return index - 1;
3432
},
3533
getRecordByIndex: (inputIndex: number): HookStateItem =>

0 commit comments

Comments
 (0)