Updates items in the query cache based on provided IDs and new data.

updateItemsFromQueryCache({
queryClient,
data: { name: 'Updated Name' },
ids: [1, 2, 3],
queryKeysOne: [['get-one', 'posts', {}, '1']],
queryKeysList: [['get-list', 'posts', {}]],
queryKeysInfiniteList: [['get-infinite-list', 'posts', {}]]
});
  • Type Parameters

    • TData = any

      The type of data stored in the cache.

    Parameters

    • params: {
          data: OnlyObject;
          ids: (string | number)[];
          queryKeysInfiniteList?: ["get-infinite-list", ...any[]][];
          queryKeysList?: ["get-list", ...any[]][];
          queryKeysOne?: ["get-one", ...any[]][];
      }

      The parameters for the function.

      • data: OnlyObject

        The new data to update the corresponding items.

      • ids: (string | number)[]

        The array of item IDs to update.

      • OptionalqueryKeysInfiniteList?: ["get-infinite-list", ...any[]][]

        Cache keys for infinite list queries that should be updated.

      • OptionalqueryKeysList?: ["get-list", ...any[]][]

        Cache keys for list queries that should be updated.

      • OptionalqueryKeysOne?: ["get-one", ...any[]][]

        Cache keys for single queries that should be updated.

    Returns void