#Do I really need useMutation?

11 messages · Page 1 of 1 (latest)

tired tendon
#

I have a page with couple of dialogs to change the data in it (CRUD, but there are several different items in it). In the actual page contents are inside a useQuery isLoading clause and it should show a spinner when this is true. It seems like data fetching is done when I e.g. delete something (I run invalidateQueries after the operation) but the page won't update until I force it (visit another window). I though isLoading should make it update?

fast lark
#

I don't understand the question. please show a reproduction

tired tendon
#

That would be quite impossible as that would mean letting people delete data from my database without authorisation.

#

Reproduction would also pretty much necessitate that or creating the database somewhere else.

#

I try to explain in more detail:
I have a Work view. It uses useQuery() and gets the isLoading state. Inside the tsx code I have { isLoading ? <ProgressSpinner> : <div>...</div>}

#

This query is called Work + work.id.

#

(The key that is)

#

Inside the Work page I have a list of Editions whose contents are loaded with the same query.

#

For each Edition there is an edit and delete button.

#

When I click the Delete button the delete functionality is run. This includes a queryClient.invalidateQueries call. I can see from the Query Tools that work data is refreshed.

#

But the page doesn't show the changes. It's like isLoading never changes state?