How to wait for 'clean' queryCollection
This is related to this scenario here: https://discord.com/channels/719702312431386674/1369767025723052134/1423904416272089089.
I'm creating a row if it does not already exist. If it does exist, the API will return an error, and the desired behaviour is that it refetches to sync with the query state. However, at this point the change gets reverted, triggering the same mutation to run again.
I'm wondering if there's a way to wait for the collection to be 'clean': that is that there was a refetch and no errors occured since.
Here's some code for context:
To give some more context, the querySubjects comes from a tanstack query on a different API I don't control.
I'm creating a row if it does not already exist. If it does exist, the API will return an error, and the desired behaviour is that it refetches to sync with the query state. However, at this point the change gets reverted, triggering the same mutation to run again.
I'm wondering if there's a way to wait for the collection to be 'clean': that is that there was a refetch and no errors occured since.
Here's some code for context:
To give some more context, the querySubjects comes from a tanstack query on a different API I don't control.