Skip to content

Commit c83df0b

Browse files
committed
fix: save tabs data after their parent was reopened
1 parent 1991d33 commit c83df0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/services/tabs.fg.create.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ export async function reopen(
303303

304304
// Fix tree
305305
let treeUpdateNeeded = false
306+
const toSave: Tab[] = []
306307
for (const oldId of Object.keys(treeUpdate)) {
307308
const children = treeUpdate[oldId]
308309
const newId = idsMap[oldId]
@@ -311,10 +312,14 @@ export async function reopen(
311312
if (!treeUpdateNeeded) treeUpdateNeeded = true
312313
for (const childId of children) {
313314
const childTab = Tabs.byId[childId]
314-
if (childTab) childTab.parentId = newId
315+
if (childTab) {
316+
childTab.parentId = newId
317+
toSave.push(childTab)
318+
}
315319
}
316320
}
317321
if (treeUpdateNeeded) Tabs.updateTabsTree(minIndex, maxIndex + 1)
322+
if (toSave.length) toSave.forEach(t => Tabs.saveTabData(t.id))
318323
}
319324

320325
export async function open(

0 commit comments

Comments
 (0)