From a7e8a6ef2ebf306ee11372bd4e42b741a4871325 Mon Sep 17 00:00:00 2001 From: red person Date: Wed, 28 Oct 2026 02:40:54 +0300 Subject: [PATCH] fix(memory): reset category filter when its last entry disappears --- static/js/memory.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/memory.js b/static/js/memory.js index fe8f7a978..57793e0c7 100644 --- a/static/js/memory.js +++ b/static/js/memory.js @@ -163,11 +163,13 @@ function buildCategoryChips() { const container = document.getElementById('memory-category-filters'); if (!container) return; + const cats = new Set(memories.map(m => m.category || 'fact')); + if (activeCategory !== 'all' && !cats.has(activeCategory)) activeCategory = 'all'; + // Hide the chip row entirely when there are no memories — no point showing // an "all" chip with nothing to filter. if (!memories.length) { container.innerHTML = ''; return; } - const cats = new Set(memories.map(m => m.category || 'fact')); const sorted = ['all', ...Array.from(cats).sort()]; const counts = memories.reduce((result, memory) => { const category = memory.category || 'fact';