Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix search results in folderViz and Calendar perspectives

sytolk0515577d4087
diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.ts
index 4e798fad7..92cbe9532 100644
--- a/src/renderer/services/utils-io.ts
+++ b/src/renderer/services/utils-io.ts
@@ -1312,3 +1312,23 @@ export function toBase64Image(uint8Array): string {
}
return undefined;
}
+
+/**
+ * shallow compare Entries array (and optional mtime)
+ * @param a
+ * @param b
+ */
+export function entriesEquals(
+ a?: TS.FileSystemEntry[],
+ b?: TS.FileSystemEntry[],
+) {
+ if (a === b) return true;
+ if (!Array.isArray(a) || !Array.isArray(b)) return false;
+ if (a.length !== b.length) return false;
+ for (let i = 0; i < a.length; i++) {
+ if (a[i].path !== b[i]?.path) return false;
+ // optional check if you have mtime/mtime-like field
+ if ((a[i] as any).mtime !== (b[i] as any)?.mtime) return false;
+ }
+ return true;
+}