Skip to content

Commit 9ede82f

Browse files
JasonHokuclaude
andcommitted
fix: label mode unique-only not working on first load and not updating
computeLabelGlobalValues() now runs after loadSession() assigns data so unique-only filtering works immediately. processNewData() calls refreshLabelOverlays() so existing card labels update when new images change what's unique. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5fef83d commit 9ede82f

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

resources/logic_events.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ window.addEventListener('message', (event) => {
6565
} else {
6666
// Fallback: sync activeData and do full reprocess
6767
activeData = fullManifest.items;
68+
if (typeof computeLabelGlobalValues === 'function' && labelMode && labelMode.enabled) {
69+
computeLabelGlobalValues();
70+
}
6871
refreshIndices();
6972
updateFiltersForNewData(payload.new_items);
7073
updateDataPipeline();
@@ -80,11 +83,14 @@ window.addEventListener('message', (event) => {
8083
fullManifest = payload.manifest;
8184
activeData = fullManifest.items || [];
8285
meta = payload.meta || {};
83-
8486

85-
87+
// Recompute label global values with new data
88+
if (typeof computeLabelGlobalValues === 'function' && labelMode && labelMode.enabled) {
89+
computeLabelGlobalValues();
90+
}
91+
8692
refreshIndices();
87-
93+
8894
// Full reprocess needed
8995
updateDataPipeline();
9096
}

resources/logic_pipeline.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,12 @@ function processNewData(newItems) {
363363
refreshIndices();
364364

365365
// Recompute label global values when data changes (new items may change what's unique)
366+
// Then refresh ALL existing card labels since what's "unique" may have changed
366367
if (typeof computeLabelGlobalValues === 'function' && labelMode && labelMode.enabled) {
367368
computeLabelGlobalValues();
369+
if (typeof refreshLabelOverlays === 'function') {
370+
refreshLabelOverlays();
371+
}
368372
}
369373

370374
// Update filter options

resources/logic_utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ async function loadSession() {
9393

9494
console.log(`[Load] 📦 activeData now has ${activeData.length} items`);
9595

96+
// 4b. Recompute label global values with new data so unique-only works on first load
97+
if (typeof computeLabelGlobalValues === 'function' && labelMode && labelMode.enabled) {
98+
computeLabelGlobalValues();
99+
}
100+
96101
// 5. Reset indices
97102
refreshIndices();
98103

0 commit comments

Comments
 (0)