diff --git a/src/lib/Diff.ts b/src/lib/Diff.ts index 8c4cea8517..b1436649ea 100644 --- a/src/lib/Diff.ts +++ b/src/lib/Diff.ts @@ -158,7 +158,7 @@ export default class Diff { const DAG = folderMoves .reduce((DAG, action1) => { DAG[action1.payload.id] = folderMoves.filter(action2 => { - if (action1 === action2 || action1.payload.id === action2.payload.id) { + if (action1 === action2 || String(action1.payload.id) === String(action2.payload.id)) { return false } return ( diff --git a/src/lib/LocalTabs.ts b/src/lib/LocalTabs.ts index 4a3b8a9de3..f651c75043 100644 --- a/src/lib/LocalTabs.ts +++ b/src/lib/LocalTabs.ts @@ -117,7 +117,7 @@ export default class LocalTabs implements IResource { // Not perfect but good enough (Problem: [a,X,c] => insert(b,0) => [b, X, a, c]) if (originalTabs.length !== order.length) { const untouchedChildren = originalTabs.map((tab, i) => [i, tab]).filter(([, tab]) => - !order.some(item => tab.id === item.id) + !order.some(item => String(tab.id) === String(item.id)) ) try { for (const [index, child] of untouchedChildren) { diff --git a/src/lib/Scanner.ts b/src/lib/Scanner.ts index 1c70bc50ca..83630f4ac2 100644 --- a/src/lib/Scanner.ts +++ b/src/lib/Scanner.ts @@ -224,7 +224,7 @@ export default class Scanner { const moves = this.diff.getActions(ActionType.MOVE) const updates = this.diff.getActions(ActionType.UPDATE) updates.forEach(update => { - if (moves.find(move => move.payload.id === update.payload.id)) { + if (moves.find(move => String(move.payload.id) === String(update.payload.id))) { this.diff.retract(update) } }) @@ -265,7 +265,7 @@ export default class Scanner { for (const folderId in targets) { const newFolder = this.newTree.findItem(ItemType.FOLDER, folderId) as Folder - const duplicate = this.diff.getActions(ActionType.REORDER).find(a => a.payload.id === newFolder.id) + const duplicate = this.diff.getActions(ActionType.REORDER).find(a => String(a.payload.id) === String(newFolder.id)) if (duplicate) { this.diff.retract(duplicate) } diff --git a/src/lib/Tree.ts b/src/lib/Tree.ts index 7415229679..b4511f248e 100644 --- a/src/lib/Tree.ts +++ b/src/lib/Tree.ts @@ -363,7 +363,7 @@ export class Folder { static getAncestorsOf(item: TItem, tree: Folder): TItem[] { const ancestors = [item] let parent = item - while (parent.id !== tree.id) { + while (String(parent.id) !== String(tree.id)) { ancestors.push(parent) parent = tree.findItem(ItemType.FOLDER, parent.parentId) if (!parent) { diff --git a/src/lib/adapters/Caching.ts b/src/lib/adapters/Caching.ts index 058828e949..e7da227b6a 100644 --- a/src/lib/adapters/Caching.ts +++ b/src/lib/adapters/Caching.ts @@ -65,7 +65,7 @@ export default class CachingAdapter implements Adapter { } foundBookmark.url = newBm.url foundBookmark.title = newBm.title - if (foundBookmark.parentId === newBm.parentId) { + if (String(foundBookmark.parentId) === String(newBm.parentId)) { return } const foundOldFolder = this.bookmarksCache.findFolder( @@ -154,12 +154,12 @@ export default class CachingAdapter implements Adapter { } order.forEach(item => { const child = folder.findItem(item.type, item.id) - if (!child || child.parentId !== folder.id) { + if (!child || String(child.parentId) !== String(folder.id)) { throw new UnknownFolderItemOrderError(id + ':' + JSON.stringify(item)) } }) folder.children.forEach(child => { - const item = order.find((item) => item.type === child.type && item.id === child.id) + const item = order.find((item) => item.type === child.type && String(item.id) === String(child.id)) if (!item) { throw new MissingItemOrderError( id + ':' + child.inspect() diff --git a/src/lib/adapters/NextcloudBookmarks.ts b/src/lib/adapters/NextcloudBookmarks.ts index a9a01076c0..406ff70b57 100644 --- a/src/lib/adapters/NextcloudBookmarks.ts +++ b/src/lib/adapters/NextcloudBookmarks.ts @@ -395,7 +395,7 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes } }) } - return recurseChildren(folderId, children).filter(item => item.id !== this.lockId) + return recurseChildren(folderId, children).filter(item => String(item.id) !== String(this.lockId)) } else { // We don't have the children endpoint available, so we have to query all bookmarks that exist :( await this.getBookmarksList() @@ -483,7 +483,7 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes ) } await recurseChildFolders(tree, childFolders, childrenOrder, childBookmarks, layers) - return tree.children.filter(item => item.id !== this.lockId) + return tree.children.filter(item => String(item.id) !== String(this.lockId)) } } @@ -829,7 +829,7 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes ) const newFolder = this.tree.findFolder(newBm.parentId) - if (!newFolder.children.find(item => item.id === newBm.id && item.type === 'bookmark')) { + if (!newFolder.children.find(item => String(item.id) === String(newBm.id) && item.type === 'bookmark')) { newFolder.children.push(newBm) } newBm.id = upstreamId + ';' + newBm.parentId diff --git a/src/lib/browser/BrowserTree.ts b/src/lib/browser/BrowserTree.ts index 3eec7c09b9..b0b34cbeec 100644 --- a/src/lib/browser/BrowserTree.ts +++ b/src/lib/browser/BrowserTree.ts @@ -36,7 +36,7 @@ export default class BrowserTree implements IResource { const recurse = (node, parentId?, rng?) => { if ( allAccounts.some( - acc => acc.getData().localRoot === node.id && node.id !== this.rootId && !acc.getData().nestedSync + acc => acc.getData().localRoot === node.id && String(node.id) !== String(this.rootId) && !acc.getData().nestedSync ) ) { // This is the root folder of a different account and the user doesn't want nested sync @@ -223,8 +223,8 @@ export default class BrowserTree implements IResource { if (realTree.children.length !== order.length) { const untouchedChildren = realTree.children.map((child,i) => [i, child]).filter(([, child]) => child.url - ? !order.some(item => item.type === ItemType.BOOKMARK && item.id === child.id) - : !order.some(item => item.type === ItemType.FOLDER && item.id === child.id) + ? !order.some(item => item.type === ItemType.BOOKMARK && String(item.id) === String(child.id)) + : !order.some(item => item.type === ItemType.FOLDER && String(item.id) === String(child.id)) ) try { Logger.log('Move untouched children back into place', {untouchedChildren: untouchedChildren.map(([i, item]) => [i, item.id])}) diff --git a/src/lib/strategies/Default.ts b/src/lib/strategies/Default.ts index ab39dc83ac..08efe4f320 100644 --- a/src/lib/strategies/Default.ts +++ b/src/lib/strategies/Default.ts @@ -446,8 +446,8 @@ export default class SyncProcess { if ( // Don't create duplicates! - targetPlan.getActions(ActionType.MOVE).find(move => move.payload.id === payload.id) || - sourceDiff.getActions(ActionType.MOVE).find(move => move.payload.id === payload.id) || + targetPlan.getActions(ActionType.MOVE).find(move => String(move.payload.id) === String(payload.id)) || + sourceDiff.getActions(ActionType.MOVE).find(move => String(move.payload.id) === String(payload.id)) || // Don't move back into removed territory targetRemovals.find(remove => Diff.findChain(mappingsSnapshot, allCreateAndMoveActions, sourceTree, action.payload, remove)) || sourceRemovals.find(remove => Diff.findChain(mappingsSnapshot, allCreateAndMoveActions, targetTree, action.payload, remove)) @@ -829,12 +829,12 @@ export default class SyncProcess { const reconciled = !cacheItem const changedLocally = (localHash !== cacheHash) || - (cacheItem && localItem.parentId !== cacheItem.parentId) + (cacheItem && String(localItem.parentId) !== String(cacheItem.parentId)) const changedUpstream = (cacheHash !== serverHash) || (cacheItem && - cacheItem.parentId !== - mappingsSnapshot.ServerToLocal.folder[serverItem.parentId]) + String(cacheItem.parentId) !== + String(mappingsSnapshot.ServerToLocal.folder[serverItem.parentId])) return changedLocally || changedUpstream || reconciled } diff --git a/src/lib/strategies/Merge.ts b/src/lib/strategies/Merge.ts index 9411934fee..7b450360c6 100644 --- a/src/lib/strategies/Merge.ts +++ b/src/lib/strategies/Merge.ts @@ -128,8 +128,8 @@ export default class MergeSyncProcess extends Default { oldItem.parentId = Mappings.mapParentId(mappingsSnapshot, oldItem, action.payload.location) if ( - targetPlan.getActions(ActionType.MOVE).find(move => move.payload.id === payload.id) || - sourceDiff.getActions(ActionType.MOVE).find(move => move.payload.id === payload.id) + targetPlan.getActions(ActionType.MOVE).find(move => String(move.payload.id) === String(payload.id)) || + sourceDiff.getActions(ActionType.MOVE).find(move => String(move.payload.id) === String(payload.id)) ) { // Don't create duplicates! return diff --git a/src/ui/views/native/Tree.vue b/src/ui/views/native/Tree.vue index ae089832e2..525f228355 100644 --- a/src/ui/views/native/Tree.vue +++ b/src/ui/views/native/Tree.vue @@ -392,7 +392,7 @@ export default { }, breadcrumbs() { const folders = [this.currentFolder] - while (folders[folders.length - 1 ].id !== this.tree.id) { + while (String(folders[folders.length - 1 ].id) !== String(this.tree.id)) { folders.push(this.findItem(folders[folders.length - 1 ].parentId, this.tree)) } return folders.reverse()