Skip to content

Instantly share code, notes, and snippets.

Shrugsy / rtkQueryCacheUtils.ts
Last active December 12, 2023 10:40
RTK Query cache utils. Useful abstractions for creating `provides`/`invalidates` cache data tags against endpoints.
View rtkQueryCacheUtils.ts
import { FetchBaseQueryError } from '@rtk-incubator/rtk-query/dist';
* Default tags used by the cacher helpers
const defaultTags = ["UNAUTHORIZED", "UNKNOWN_ERROR"] as const;
type DefaultTags = typeof defaultTags[number];
function concatErrorCache<T, ID>(
existingCache: CacheList<T, ID>,