Skip to content

Commit 9c64fda

Browse files
committed
fix(Folder#toJSON): Make sure children are properly serialized
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 0fe68fe commit 9c64fda

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/lib/Tree.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ export class Folder<L extends TItemLocation> {
516516
Object.entries(obj).forEach(([key, value]) => {
517517
if (key === 'index') return
518518
if (!(key in result)) {
519+
if (key === 'children') {
520+
value = value.map((child) => child.toJSON())
521+
}
519522
result[key] = value
520523
}
521524
})

src/lib/browser/BrowserAccountStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export default class BrowserAccountStorage {
146146
async setCache(data) {
147147
await BrowserAccountStorage.setEntry(
148148
`bookmarks[${this.accountId}].cache`,
149-
data
149+
data.toJSON ? data.toJSON() : data
150150
)
151151
}
152152

0 commit comments

Comments
 (0)