Skip to content

Fuzzy matching against args in api.util.updateQueryData #3564

@hornta

Description

@hornta

Would it be possible to add support for fuzzy matching against args in the utility updateQueryData? There are instances where I want to change on all cached endpoints of a query regardless of what args they are cached on.

For example here the getTransactions query also have a type argument but I simply do not core what the value is. I only care updating where both companyDomain and planId matches.

          const patchResult = dispatch(
            myApi.util.updateQueryData(
              "getTransactions",
              { companyDomainId, planId },
              (draft) => {
                Object.assign(draft, updatedTransactions);
              }
            )
          );

I'm thinking of something like how I match objects in vitest: expect.objectContaining({ companyDomainId, planId, type: expect.any() }),

My workaround is to just pass everything I need as arguments for this query but it feels a bit cumbersome to have to do it just because I need it on my onQueryStarted method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions