Offline first Persist being removed #8696
Replies: 1 comment 3 replies
-
we don’t do this because errors aren’t serializable. You can overwrite the when a query is in
typescript will allow it. Now if you have data, and then get an error, you have this in the cache:
once you insist on writing this to the storage,
which would make the above code fail at runtime because we cannot read message of null. But I have literally written the same explanation in the other discussion you linked (#3623 (reply in thread)), so I’m not sure what more you’d need ? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to wrap my head around an offline first approach using
persistQueryClient
.The current issue is that if the app isn't "offline" but the API requests are failing (which is valid of behind proxy, or some other network issue) it then removes it from the local storage. This seems inline with the docs.
My issue is, that I don't want it to remove it from the storage. If there is an error to the request, and there is valid cached data, then it should continue returning the cached data in persistant storage, and not show as an error.
In the case of having an error, and no cached data, then it would enter the error state.
A similar discussion was had in #3623 - although this isn't the same use-case as I don't want to serialize errors.
What would be the best solution around this?
Beta Was this translation helpful? Give feedback.
All reactions