fix: handle invalid JSON response in facets query#813
fix: handle invalid JSON response in facets query#813cyphercodes wants to merge 1 commit intosupermemoryai:mainfrom
Conversation
Add validation for facets API response to prevent JSON parse errors when the server returns unexpected data. Falls back to empty facets and zero total when response is invalid. Fixes supermemoryai#802
EntelligenceAI PR SummaryAdds defensive runtime validation for the facets API response in
Confidence Score: 5/5 - Safe to Merge
Key Findings:
|
WalkthroughThis update adds runtime validation to the facets query response in the Changes
🔗 Cross-Repository Impact AnalysisEnable automatic detection of breaking changes across your dependent repositories. → Set up now Learn more about Cross-Repository AnalysisWhat It Does
How to Enable
Benefits
|
Problem
The dashboard shows a JSON parse error on 'Total memories stored' display (Issue #802).
Error:
Unexpected non-whitespace character after JSON at position 4This happens when the facets API endpoint returns unexpected data that isn't valid JSON, causing the frontend to fail when trying to parse the response.
Solution
Add validation for the facets API response to ensure it has the expected shape before returning it. If the response is invalid, fall back to empty facets (
[]) and zero total (0).Changes
memories-grid.tsxTesting
Fixes #802