mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
Merge 854455c29d into 3f7b9667c6
This commit is contained in:
commit
1789143132
1 changed files with 17 additions and 0 deletions
|
|
@ -395,6 +395,23 @@ export function MemoriesGrid({
|
|||
}
|
||||
}, [agentSourceCounts, selectedAgentSource, setSelectedAgentSource])
|
||||
|
||||
// Category filters are URL state that survives a space switch. Drop any that
|
||||
// the current space's facets no longer contain, otherwise the grid stays
|
||||
// filtered down to zero results with no visible pill to clear (the chip only
|
||||
// renders for facets that exist here). Mirrors the agent-source reset above.
|
||||
useEffect(() => {
|
||||
if (!facetsData || selectedCategories.length === 0) return
|
||||
const available = new Set<string>(
|
||||
facetsData.facets.map((facet) => facet.category),
|
||||
)
|
||||
const stillValid = selectedCategories.filter((category) =>
|
||||
available.has(category),
|
||||
)
|
||||
if (stillValid.length !== selectedCategories.length) {
|
||||
void setSelectedCategories(stillValid.length > 0 ? stillValid : null)
|
||||
}
|
||||
}, [facetsData, selectedCategories, setSelectedCategories])
|
||||
|
||||
const {
|
||||
data,
|
||||
error,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue