You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to @urql/exchange-graphcache@9, it crashes on load:
Uncaught (in promise) SyntaxError: Unexpected token 'O', "O" is not valid JSON
at JSON.parse (<anonymous>)
at data.ts:720:49
at data.ts:727:19
Deleting the IndexedDB database fixes the issue.
How can we resolve this at runtime? The code path is
// React root rendered// ...// this is needed to call urql's `createClient`:constmyCacheExchange=cacheExchange({// ...storage: makeDefaultStorage({idbName, ...,onCacheHydrated: ()=> ... })})
There is no hook for validating IDB data here, and the async nature of IDB makes it trickier to scan for a pattern before creating the cache. The React tree below the API provider would need to be deferred while this scan is done.
It should probably be the responsibility of graphcache to detect legacy data and clear it, since it's already making itself available to the client asynchronously without blocking it. It's also hard for consumers to know how to detect old cache data.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
After upgrading to
@urql/exchange-graphcache@9, it crashes on load:Deleting the IndexedDB database fixes the issue.
How can we resolve this at runtime? The code path is
There is no hook for validating IDB data here, and the async nature of IDB makes it trickier to scan for a pattern before creating the cache. The React tree below the API provider would need to be deferred while this scan is done.
It should probably be the responsibility of graphcache to detect legacy data and clear it, since it's already making itself available to the client asynchronously without blocking it. It's also hard for consumers to know how to detect old cache data.
Beta Was this translation helpful? Give feedback.
All reactions