diff --git a/docs/compare-to-tanstack.md b/docs/compare-to-tanstack.md index 11941a9..2740554 100644 --- a/docs/compare-to-tanstack.md +++ b/docs/compare-to-tanstack.md @@ -1,3 +1,3 @@ # Migrating from Tanstack -- no keys, caches function + arguments by default +- no keys (tags don't require user to adopt naming scheme), caches function + arguments by default diff --git a/docs/core-concepts/queries.md b/docs/core-concepts/queries.md index 41b8e0c..cd3d20e 100644 --- a/docs/core-concepts/queries.md +++ b/docs/core-concepts/queries.md @@ -108,7 +108,7 @@ The `useQuery` function adds some super useful, vue specific functionality you'd ### Parameters argument is reactive -When parameters for your query function change, the query is automatically updated. +The parameters for your query must be provided as a getter, which ensures they are reactive. When the parameters change, the query is automatically updated. The old query is disposed and a new query is created. ```ts import { useQuery } from '@kitbag/query' diff --git a/docs/core-concepts/tags-invalidation.md b/docs/core-concepts/tags-invalidation.md index 2522b9b..ef69ffe 100644 --- a/docs/core-concepts/tags-invalidation.md +++ b/docs/core-concepts/tags-invalidation.md @@ -1,402 +1,79 @@ # Tags & Invalidation - \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 2997f67..ef5464b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,12 +7,28 @@ import { MutationAction, MutationData, MutationTagsContext, MutationTagsBeforeCo import { QueryAction, QueryData, QueryActionArgs, QueryTags, QueryOptions, Query, AwaitedQuery } from './types/query' import { QueryTag, QueryTagType, QueryTagCallback, QueryTagFactory } from './types/tags' -const { query, useQuery } = createQueryClient() +const { + query, + useQuery, + defineQuery, + setQueryData, + refreshQueryData, + mutate, + useMutation, + defineMutation, +} = createQueryClient() export { createQueryClient, tag, - query, useQuery + query, + useQuery, + defineQuery, + setQueryData, + refreshQueryData, + mutate, + useMutation, + defineMutation } export type {