transformError
was never fully implemented so they are being removed and might come back if they is a real-word use case for them- If you were using the
delayLoadingRef
util, use the@pinia/colada-plugin-delay
instead. - Renaming
Error
todefaultError
allows to differentiate the property from the existing global Error class. Upgrading should be straightforward.
- add initial delay plugin (42c8760)
- add track and untrack actions for plugins (8902ba3)
- allow dynamic values for auto refetches (63d2fd0)
- allow extending useQuery return (ef06628)
- expose more types (4447d6d)
- plugins: pass scope for added variables (a3b666f)
- work without the plugin (696f88e)
- avoid broken reactivity in defineQuery (4c48abc)
- dedupe pinia colada (6ace8e8)
- keep data if signal is aborted (de5cde5)
- pass onMutate context (618312b), closes #95
- remove queryCache from mutation hooks (3f1119a)
- run create in ssr too (1a6fa4a)
- ssr: throw on error in query (58b7f69)
- upgrade to new cache format (03e1683)
- query: remove unused transformError and setup options (de0cb48)
- remove delayLoadingRef helper in favor of the plugins (4c9b4cb)
- rename the global
Error
property inTypesConfig
to (0021426)
- allow gcTime to never be set (4714b9a)
- eagerly change asyncStatus on cancel (b2f1349)
- staleTime of 0 always refreshes (66ef9ec)
- mutations: This wasn't needed as instead, one can use
useQueryCache()
outside. It could be added back if needed but it's more pragmatic to start without it. - query: The
queryCache.cancelQuery()
is renamed toqueryCache.cancel()
to better match the other functions naming. A new functionqueryCache.cancelQueries()
is added to actually cancel one or multiple queries instead of just one. - plugins: In plugins,
cache
is renamed toqueryCache
for consistency. - This makes it clearer that
queryCache
is the result ofuseQueryCache()
.
- add mutation store (#47) (7954f83)
- hmr: warn against bugs (7bb44a0)
- nuxt: add auto imports (964bce2)
- nuxt: support colada.options (57a0430)
- predicate in filter (2fc62b7)
- query: add cancelQueries (a374ee2)
- run defined mutations in effect scope (86ff5ed)
- nuxt: plugins (fd95add)
- tree shake unused stores (e0ede7e)
- mutations: Remove
queryCache
from the context (d9c2509) - plugins: rename
cache
toqueryCache
(c97639b) - rename
caches
toqueryCache
(e514d33)
- This change is mainly to simplify migration from TanStack Query.
- caches.invalidateQueries only fetches active queries
- The
keys
option that automatically invalidate keys has been renamed toinvalidateKeys
and moved to a plugin. This is in practice not needed. It's just an opinionated convenience that can be replaced by directly invalidating queries in the cache with theonSettled()
hook inuseMutation()
:
const { mutate } = useMutation({
onSettled({ caches, vars: { id } }) {
caches.invalidateQueries({ key: ['contacts-search'] })
caches.invalidateQueries({ key: ['contacts', id] })
},
mutation: (contact) => patchContact(contact),
})
- caches.invalidateQueries only fetches active queries (e8d9088)
- rename
keys
toinvalidateKeys
and move to plugin (f709928) - useMutation hooks now use positional arguments (dce00b4)
- allow nullish return in placeholderData (1fae179)
- wip nuxt module (66eca6e)
- wip placeholderData (307e366)
- query-cache: To better match the arguments, the
setQueryState
action has been renamed tosetEntryState
.
- mutations: add variables (2e03a93)
- query-cache: Rename
setQueryState
tosetEntryState
(f481eb0) - warn: warn about reused keys (7375a19)
- skip reactivity traversal in store (3984a3a)
- ssr: expose reviveTreeMap (32b4f17)
- ssr: mark raw tree node in reviver (4ff13ad)
-
isFetching
fromuseQuery()
is renamed toisLoading
to better reflect that it's connected toasyncStatus
. -
The setup option in useQuery now receives the options as the second argument instead of a context object with the query return value and the options. This allows the setup function to have a more predictable signature and makes it easier to type. Only
PiniaColada
has this option, it has been removed from useQuery. Overall, the option still needs more thinking and will probably change in the future again. -
plugins: The
onSuccess
,onError
, andonSettled
global hooks have been moved fromPiniaPlugin
to a Pinia Colada plugin:PiniaColadaQueryHooksPlugin
app.use(PiniaColada, { + plugins: [ + PiniaColadaQueryHooksPlugin({ onSuccess() {}, onError() {}, onSettled() {}, + }), + ], })
-
This feature splits up the
status
state into two different status properties:
status
is now just for the data'pending' | 'success' | 'error'
queryStatus
tells if the query is still running or not with'idle' | 'running'
refetch
,refresh
and similar methods now resolve thestate
property without rejecting. This is usually more convenient.- The
QueryStatus
type has been split intoDataStateStatus
andOperationStateStatus
. - the cache store is going through a refactor to empower plugins. This change shouldn't affect end users unless you are directly using the cache store. As a result a lot of the actions have been renamed
- refetch -> fetch
- invalidateEntry -> invalidate
- ensureEntry -> ensure
Their arguments have changed as well.
- This release removes the deprecated
QueryPlugin
. UsePiniaColada
instead.
- add a
state
property touseQuery
for type narrowing (22f3e21) - mutation: refetch active queries (#65) (3ebc734)
- plugins: Refactor query global hooks into a plugin (bbe5199)
- query: add
active
property to query entry (994db63), closes #65 - split useMutation status like useQuery (6c6078f)
- rename
isFetching
toisLoading
(003f7a1) - rename cache store actions (792ec6e)
- Replace QueryPlugin with PiniaColada (2a3f3d9)
- useQuery setup option now receives the options as the second argument (a86b41d)
- hmr: always update options (a6a6b7a)
- rename type
UseEntryKey
toEntryKey
- the exported type 'UseQueryKey' is replaced by the more generic type 'UseEntryKey', which will be also used to type mutations
- debug plugin (8fde25b)
- expose plugin types (83ef198)
- mutation: allow passing mutation variables to mutation key getter (bc8a47f)
- retry plugin (0d837a2)
- support plugins and deprecate
QueryPlugin
in favor ofPiniaColada
(bde53d9) - use-query: Add enabled option (#43) (1b755c5)
- wip: add gcTime (#29) (56659d1)
- gcTime on defined queries (#50) (82df409)
- query: query refresh on defineQuery output composable call (28a3ec1)
- trigger nested actions (7e3a9f6)
- Revert "refactor: add a stale getter" (6e059f4)
- mutation: Rename type
UseQueryStatus
toQueryStatus
- mutation:
mutate
no longer returns a promise and catches errors to be safely used in templates. The old behavior remains the same withmutateAsync
- mutation: the
mutation
option inuseMutation()
now only accepts one argument for the variables. This allows to add extra parameters in the future like a signal, an extra context, etc
- abort pending query signal on new query (6b6195f)
- allow typing the error with transformError (fd35f6f)
- mutation: add mutateAsync (5c97b69)
- mutation: allow passing the context to mutation (b9acca0)
- mutation: defineMutation wip (5866907)
- mutation: require one argument only for useMutation (86b5996)
- query: add data and errors to global hooks (b4caeca)
- query: defineQuery (e0f7768)
- return promise when invalidating query (c431284)
- useMutation: add hook context (0894a81)
- useMutation: add hooks (c44af13)
- mutation: rename UseQueryStatus to QueryStatus (ff0067a)
- onScopeDispose guard (0ed15fe)
- allow writing to entries (8e9ac7e)
- types: allow default error type (68c2f8d)
- avoid computed warns (c11ee2f)
- remove internal global defaults
- force array of keys to avoid easy mistakes
- pass signal to query (bf1666c)
- add delayLoadingRef (ebbc503)
- avoid warn onScopeDispose (47ac1a6)
- rename data fetching store
- replace class usage
- add
QueryPlugin
to configure useQuery() status
property,isPending
,isFetching
are now a bit different.
- ssr: wip initial version (8e6cbf6)
- adapt status (2d5625c)
- add
QueryPlugin
to configure useQuery() (67cb2d3) - rename data fetching store (b9ef0fb)
- replace class usage (9bf1fd9)
- useMutation: options (23eccb1)
- The option
fetcher
foruseQuery()
has been renamed toquery
. The optionmutator
foruseMutation()
has been renamedmutation
.
- rename options for
useQuery
anduseMutation
(28ecc75)
- remove iife version
- accept function in setEntryData (2abb7c0)
- allow array of keys (7be2e80)
- do not refresh by default outside of components (b6e45fb)
- traverse tree map (b12547f)
- wip tree map (b87bff4)
- remove iife version (0ee5c8a)
- rename options
- swallow error in automatic refreshes (d955754)
- rename options (f6d01c5)
- initial version (7abe80d)