Skip to content

Commit 25062d5

Browse files
committed
fix(Bookmark#clone): Obey withHash argument
Signed-off-by: Marcel Klehr <[email protected]>
1 parent d5db3bf commit 25062d5

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/lib/Tree.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ export class Bookmark<L extends TItemLocation> {
8888
}
8989

9090
clone(withHash?: boolean):Bookmark<L> {
91-
return Object.create(this)
91+
const bookmark = Object.create(this)
92+
if (!withHash) {
93+
bookmark.hashValue = {}
94+
}
95+
return bookmark
9296
}
9397

9498
cloneWithLocation<L2 extends TItemLocation>(withHash:boolean, location: L2): Bookmark<L2> {

src/lib/adapters/Git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export default class GitAdapter extends CachingAdapter {
184184
Logger.log('onSyncComplete')
185185
clearInterval(this.lockingInterval)
186186

187-
this.bookmarksCache = this.bookmarksCache.clone()
187+
this.bookmarksCache = this.bookmarksCache.clone(false)
188188
const newTreeHash = await this.bookmarksCache.hash(true)
189189
if (newTreeHash !== this.initialTreeHash) {
190190
const fileContents = this.server.bookmark_file_type === 'xbel' ? createXBEL(this.bookmarksCache, this.highestId) : createHTML(this.bookmarksCache, this.highestId)

src/lib/adapters/GoogleDrive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export default class GoogleDriveAdapter extends CachingAdapter {
321321
Logger.log('onSyncComplete')
322322
clearInterval(this.lockingInterval)
323323

324-
this.bookmarksCache = this.bookmarksCache.clone()
324+
this.bookmarksCache = this.bookmarksCache.clone(false)
325325
const newTreeHash = await this.bookmarksCache.hash(true)
326326
let xbel = createXBEL(this.bookmarksCache, this.highestId)
327327

src/lib/adapters/WebDav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export default class WebDavAdapter extends CachingAdapter {
352352
this.ended = true
353353
clearInterval(this.lockingInterval)
354354

355-
this.bookmarksCache = this.bookmarksCache.clone()
355+
this.bookmarksCache = this.bookmarksCache.clone(false)
356356
const newTreeHash = await this.bookmarksCache.hash(true)
357357
if (newTreeHash !== this.initialTreeHash) {
358358
const fullUrl = this.getBookmarkURL()

0 commit comments

Comments
 (0)