Skip to content

response in providesTags is not currentCache #3583

Open
@grtan

Description

@grtan

response in providesTags is not currentCache when use with merge, response in here is the result of each request, not results of all requests

I try store.getState(), but it throw an error

    providesTags(response, error, {domainId}) {
          /**
           * response in here is the result of each request, not results of all requests
           * so we need get the complete cache
           */
           ({data: response} = api.endpoints.getMigrations.select({
             domainId,
           })(store.getState()));

          return response
            ? [
                ...migrationsAdapter
                  .getSelectors()
                  .selectIds(response)
                  .map((id) => ({
                    type: TYPE.MIGRATION,
                    id: JSON.stringify([domainId, id]),
                  })),
                {
                  type: TYPE.MIGRATION,
                  id: JSON.stringify([domainId, 'LIST']),
                },
              ]
            : [
                {
                  type: TYPE.MIGRATION,
                  domainId: JSON.stringify([domainId, 'LIST']),
                },
              ];
        },
image

How to get the complete currentCache in providesTags?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions