Skip to content

Commit 3d1ad5b

Browse files
authored
fix scope drop children update (#83)
1 parent 3a6fb2b commit 3d1ad5b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ui/src/lib/store.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -641,19 +641,13 @@ const createRepoSlice: StateCreator<
641641
produce((state) => {
642642
// FIXME I need to modify many pods here.
643643
if (state.pods[id]?.parent === parent) return;
644+
const oldparent = state.pods[state.pods[id].parent];
644645
state.pods[id].parent = parent;
645646
// FXME I'm marking all the pods as dirty here.
646647
state.pods[id].dirty = true;
647648
state.pods[parent].children.push(state.pods[id]);
648-
const oldparent = state.pods[state.pods[id].parent];
649-
if (oldparent) {
650-
let idx = oldparent.children.findIndex((_id) => _id === id);
651-
if (idx >= 0) {
652-
oldparent.children.splice(idx, 1);
653-
oldparent.dirty = true;
654-
}
655-
}
656-
// return [id, parent, oldparent];
649+
let idx = oldparent.children.findIndex(({ id: _id }) => _id === id);
650+
oldparent.children.splice(idx, 1);
657651
})
658652
),
659653
resizeScopeSize: ({ id }) =>

0 commit comments

Comments
 (0)