Skip to content

Commit

Permalink
fix(Default#getDiffs): Don't produce UPDATEs for tabs, ever
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Dec 24, 2024
1 parent f4de82c commit 4d8bcf7
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/lib/strategies/Default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { CancelledSyncError, FailsafeError } from '../../errors/Error'

import NextcloudBookmarksAdapter from '../adapters/NextcloudBookmarks'
import CachingAdapter from '../adapters/Caching'
import LocalTabs from '../LocalTabs'

const ACTION_CONCURRENCY = 12

Expand Down Expand Up @@ -437,8 +436,23 @@ export default class SyncProcess {
this.cacheTreeRoot,
this.localTreeRoot,
// We also allow canMergeWith for folders here, because Window IDs are not stable
(oldItem, newItem) =>
(oldItem.type === newItem.type && String(oldItem.id) === String(newItem.id)) || (oldItem.type === 'folder' && oldItem.canMergeWith(newItem)),
(oldItem, newItem) => {
if (oldItem.type !== newItem.type) {
return false
}
if (oldItem.type === 'bookmark' && newItem.type === 'bookmark') {
return oldItem.url === newItem.url
}
if (oldItem.type === 'folder') {
if (String(oldItem.id) === String(newItem.id)) {
return true
}
if (oldItem.canMergeWith(newItem)) {
return true
}
}
return false
},
this.preserveOrder,
)
serverScanner = new Scanner(
Expand All @@ -448,9 +462,21 @@ export default class SyncProcess {
// (for bookmarks, because e.g. for NextcloudFolders the id of moved bookmarks changes (because their id is "<bookmarkID>;<folderId>")
// (for folders because Window IDs are not stable)
(oldItem, newItem) => {
if ((oldItem.type === newItem.type && Mappings.mappable(mappingsSnapshot, oldItem, newItem)) || (oldItem.canMergeWith(newItem))) {
newMappings.push([oldItem, newItem])
return true
if (oldItem.type !== newItem.type) {
return false
}
if (oldItem.type === 'bookmark' && newItem.type === 'bookmark') {
return oldItem.url === newItem.url
}
if (oldItem.type === 'folder') {
if (Mappings.mappable(mappingsSnapshot, oldItem, newItem)) {
newMappings.push([oldItem, newItem])
return true
}
if (oldItem.canMergeWith(newItem)) {
newMappings.push([oldItem, newItem])
return true
}
}
return false
},
Expand Down

0 comments on commit 4d8bcf7

Please sign in to comment.