TanStackT
TanStack3mo ago
14 replies
worthy-azure

How to handle old (now) invalid persisted data?

I am using the tanstack query's persist plugin to persist queries on filesystem. What's a proper approach for handling old data (coming from an API) missing fields that are now available in the API?
Should I just consider all new fields as optional and check for their existence before rendering?
Should I just invalidate the persisted cache? (I'd rather avoid this, as I cannot seem to cache bust only 1 query, I have to bust the whole cache when 1 singular query is wrong)
Was this page helpful?