From 1680a1e4e4b5ca50148f808c16fa15cbee2cdeb0 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Thu, 2 Apr 2026 19:48:20 +0200 Subject: [PATCH] fix: search issue, don't index before processed --- src/components/input/ephemeral-cache/worker.js | 3 ++- .../orchestrator/scoped-tracks/element.js | 18 +++++++++++++++--- .../orchestrator/scoped-tracks/worker.js | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/input/ephemeral-cache/worker.js b/src/components/input/ephemeral-cache/worker.js index 5198388b..d4764a83 100644 --- a/src/components/input/ephemeral-cache/worker.js +++ b/src/components/input/ephemeral-cache/worker.js @@ -83,7 +83,8 @@ export async function list(tracks) { * @type {Actions['resolve']} */ export async function resolve({ uri }) { - const blob = /** @type {Blob | undefined} */ (await IDB.get(CACHE_KEY_PREFIX + uri)); + const blob = + /** @type {Blob | undefined} */ (await IDB.get(CACHE_KEY_PREFIX + uri)); if (!blob) return undefined; let blobUrl = blobUrls.get(uri); diff --git a/src/components/orchestrator/scoped-tracks/element.js b/src/components/orchestrator/scoped-tracks/element.js index e7d731ec..d5f12953 100644 --- a/src/components/orchestrator/scoped-tracks/element.js +++ b/src/components/orchestrator/scoped-tracks/element.js @@ -54,8 +54,13 @@ class ScopedTracksOrchestrator extends BroadcastableDiffuseElement { #disabledSources = computed(() => { const col = this.#output.value?.settings.collection(); if (!col || col.state !== "loaded") return []; - const setting = col.data.find((s) => s.key === "sh.diffuse.input.disabled.uris"); + + const setting = col.data.find((s) => + s.key === "sh.diffuse.input.disabled.uris" + ); + if (!setting) return []; + try { const parsed = JSON.parse(setting.value); return Array.isArray(parsed) ? /** @type {string[]} */ (parsed) : []; @@ -158,6 +163,7 @@ class ScopedTracksOrchestrator extends BroadcastableDiffuseElement { // Watch tracks collection this.effect(async () => { const tracksCol = output.tracks.collection(); + if ((await this.isLeader()) === false) return; if (tracksCol.state !== "loaded") return; @@ -169,7 +175,9 @@ class ScopedTracksOrchestrator extends BroadcastableDiffuseElement { }); // Consult inputs - const groups = tracksCol.data.length ? await input.groupConsult(uris) : {}; + const groups = tracksCol.data.length + ? await input.groupConsult(uris) + : {}; /** @type {Set} */ const availableUris = new Set(); @@ -246,7 +254,11 @@ class ScopedTracksOrchestrator extends BroadcastableDiffuseElement { const cmp = typeof aVal === "string" && typeof bVal === "string" ? aVal.localeCompare(bVal) - : aVal < bVal ? -1 : aVal > bVal ? 1 : 0; + : aVal < bVal + ? -1 + : aVal > bVal + ? 1 + : 0; if (cmp !== 0) return cmp * dir; } diff --git a/src/components/orchestrator/scoped-tracks/worker.js b/src/components/orchestrator/scoped-tracks/worker.js index 4b58c729..381fdd73 100644 --- a/src/components/orchestrator/scoped-tracks/worker.js +++ b/src/components/orchestrator/scoped-tracks/worker.js @@ -66,6 +66,7 @@ export async function supply({ tracks }) { const tracksMap = new Map(); for (const track of tracks) { + if (!track.tags) return; tracksMap.set(track.id, track); } -- knotmirror 0.0.1