reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.71k stars 1.17k forks source link

Sometimes auto refetch not triggered #3032

Open VictorPulzz opened 1 year ago

VictorPulzz commented 1 year ago

I working on redux-toolkit and implement providersTags I have 2 query for getting data:

get: builder.query<GetResponse, GetRequest>({
      query: () => ({
        url: 'get',
      }),
      providesTags: ['TAG_TEST'],
    }),

And patch data

update: builder.mutation<UpdateResponse, UpdateRequest>({
      query: data => ({
        url: 'auth/patch',
        method: 'PATCH',
        data,
      invalidatesTags: ['TAG_TEST'],
    }),

I also have a step-by-step form, where I first have a get request that substitutes data if it has already been filled in by the user and a form where you can update the data, and the update field must be re-requested. BUT in some cases he simply does not work out, and this happens randomly ...

image
VictorPulzz commented 1 year ago

I found problem, when I use path inside patch refetch not auto triggered

image image

How fix it?

phryneas commented 1 year ago

I have no idea what you are trying to tell us with that last message, could you be a bit more specific? (And please, post code, not screenshots of code!)

All I can think of is that another refetch will not be started while the last one is running.

GeorchW commented 1 year ago

The code screenshot looks like two mutations are fired off in direct succession. My best guess would be that this is an instance of #3105