Summary
Many localStorage writes stringify non-string values without verifying types, causing JSON.stringify to throw on circular refs or BigInts.
Affected area
src/lib/cacheManager.ts (queue, cache config)
src/lib/propertyCache.ts (propchain-search-cache)
src/store/portfolioStore.ts
src/components/dashboard/DraggablePropertiesList.tsx
Steps to reproduce / impact
If a BigInt sneaks into the saved value, JSON.stringify throws and the cache silently fails to persist. In DraggablePropertiesList, an unsorted ordering can persist via the failure path.
Expected behaviour
Wrap writers in a typed helper that sanitises values (BigInt → string, Reviver/Replacer pair) and uses the existing structured logger on failure.
Acceptance criteria
Summary
Many localStorage writes stringify non-string values without verifying types, causing
JSON.stringifyto throw on circular refs or BigInts.Affected area
src/lib/cacheManager.ts(queue, cache config)src/lib/propertyCache.ts(propchain-search-cache)src/store/portfolioStore.tssrc/components/dashboard/DraggablePropertiesList.tsxSteps to reproduce / impact
If a BigInt sneaks into the saved value,
JSON.stringifythrows and the cache silently fails to persist. InDraggablePropertiesList, an unsorted ordering can persist via the failure path.Expected behaviour
Wrap writers in a typed helper that sanitises values (BigInt → string, Reviver/Replacer pair) and uses the existing structured logger on failure.
Acceptance criteria