@@ -27,7 +27,6 @@ import { CancelledSyncError, FailsafeError } from '../../errors/Error'
2727
2828import NextcloudBookmarksAdapter from '../adapters/NextcloudBookmarks'
2929import CachingAdapter from '../adapters/Caching'
30- import LocalTabs from '../LocalTabs'
3130
3231const ACTION_CONCURRENCY = 12
3332
@@ -437,8 +436,23 @@ export default class SyncProcess {
437436 this . cacheTreeRoot ,
438437 this . localTreeRoot ,
439438 // We also allow canMergeWith for folders here, because Window IDs are not stable
440- ( oldItem , newItem ) =>
441- ( oldItem . type === newItem . type && String ( oldItem . id ) === String ( newItem . id ) ) || ( oldItem . type === 'folder' && oldItem . canMergeWith ( newItem ) ) ,
439+ ( oldItem , newItem ) => {
440+ if ( oldItem . type !== newItem . type ) {
441+ return false
442+ }
443+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
444+ return oldItem . url === newItem . url
445+ }
446+ if ( oldItem . type === 'folder' ) {
447+ if ( String ( oldItem . id ) === String ( newItem . id ) ) {
448+ return true
449+ }
450+ if ( oldItem . canMergeWith ( newItem ) ) {
451+ return true
452+ }
453+ }
454+ return false
455+ } ,
442456 this . preserveOrder ,
443457 )
444458 serverScanner = new Scanner (
@@ -448,9 +462,21 @@ export default class SyncProcess {
448462 // (for bookmarks, because e.g. for NextcloudFolders the id of moved bookmarks changes (because their id is "<bookmarkID>;<folderId>")
449463 // (for folders because Window IDs are not stable)
450464 ( oldItem , newItem ) => {
451- if ( ( oldItem . type === newItem . type && Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) || ( oldItem . canMergeWith ( newItem ) ) ) {
452- newMappings . push ( [ oldItem , newItem ] )
453- return true
465+ if ( oldItem . type !== newItem . type ) {
466+ return false
467+ }
468+ if ( oldItem . type === 'bookmark' && newItem . type === 'bookmark' ) {
469+ return oldItem . url === newItem . url
470+ }
471+ if ( oldItem . type === 'folder' ) {
472+ if ( Mappings . mappable ( mappingsSnapshot , oldItem , newItem ) ) {
473+ newMappings . push ( [ oldItem , newItem ] )
474+ return true
475+ }
476+ if ( oldItem . canMergeWith ( newItem ) ) {
477+ newMappings . push ( [ oldItem , newItem ] )
478+ return true
479+ }
454480 }
455481 return false
456482 } ,
0 commit comments