mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-31 02:02:22 +01:00
fix(memory): reset category filter when its last entry disappears
This commit is contained in:
+3
-1
@@ -163,11 +163,13 @@ function buildCategoryChips() {
|
|||||||
const container = document.getElementById('memory-category-filters');
|
const container = document.getElementById('memory-category-filters');
|
||||||
if (!container) return;
|
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
|
// Hide the chip row entirely when there are no memories — no point showing
|
||||||
// an "all" chip with nothing to filter.
|
// an "all" chip with nothing to filter.
|
||||||
if (!memories.length) { container.innerHTML = ''; return; }
|
if (!memories.length) { container.innerHTML = ''; return; }
|
||||||
|
|
||||||
const cats = new Set(memories.map(m => m.category || 'fact'));
|
|
||||||
const sorted = ['all', ...Array.from(cats).sort()];
|
const sorted = ['all', ...Array.from(cats).sort()];
|
||||||
const counts = memories.reduce((result, memory) => {
|
const counts = memories.reduce((result, memory) => {
|
||||||
const category = memory.category || 'fact';
|
const category = memory.category || 'fact';
|
||||||
|
|||||||
Reference in New Issue
Block a user