-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
This recovery pattern in the docs:
Clean up collections in error states:
if (todoCollection.status === "error") { // Cleanup will stop sync and reset the collection await todoCollection.cleanup() // Collection will automatically restart on next access todoCollection.preload() // Or any other operation }
https://tanstack.com/db/latest/docs/guides/error-handling#collection-cleanup-and-restart
Is incompatible with having an exiting live query on the collection, it will throw a warning and the live queries will not recover.
We should look how to ensure you can restart an errored collection without it breaking live queries - options:
- make the restart pattern softer with a new
forceRestartthat does one of:
- internally truncates and resyncs - this should be compatible with live queries, but may not clear all state.
- send a signal to also restart live queries that are attached to the collection.
- Chang the implementation such that a live query can be attached to a "cleaned up" collection that is then restarted and when it is would restart the live query. We can continue to emit the warning, but change it to indicate that the live query will not be updating as one of its sources is cleaned up.
Discussion on Discord: https://discord.com/channels/719702312431386674/1443598939331887238
godiagonal and hedblad
Metadata
Metadata
Assignees
Labels
No labels