#Recommended pattern for non-optimistic updates in react

4 messages · Page 1 of 1 (latest)

proud solar
#

I have a collection for which all inserts/updates/deletes should not be optimistic.

I basically need the functionality of tanstack query's useMutation where I can render UI based on the mutation state while it's updating (for a loading state for example).

Is it recommended to use tanstack query's useMutation or is there another recommended pattern for tanstack db?

weak wagon
proud solar
#

Thanks for the response! In my situation, I'd like to show a loading state on a button when I insert something.

Just to make sure I get it right, where I render the button I would need to query for the element I'm creating and base the loading state on it's $synced value?