@pinia/colada
Advanced tools
Changelog
0.8.0 (2024-08-12)
isFetching
from useQuery()
is renamed to
isLoading
to better reflect that it's connected to asyncStatus
.
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
, and onSettled
global
hooks have been moved from PiniaPlugin
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
the state
property without rejecting. This is usually more convenient.QueryStatus
type has been split into
DataStateStatus
and OperationStateStatus
.Their arguments have changed as well.
QueryPlugin
. Use
PiniaColada
instead.state
property to useQuery
for type narrowing (22f3e21)active
property to query entry (994db63), closes #65Changelog
0.7.0 (2024-07-26)
UseEntryKey
to EntryKey
QueryPlugin
in favor of PiniaColada
(bde53d9)Changelog
0.6.0 (2024-04-02)
UseQueryStatus
to QueryStatus
mutate
no longer returns a promise and catches errors
to be safely used in templates. The old behavior remains the same with
mutateAsync
mutation
option in useMutation()
now only
accepts one argument for the variables. This allows to add extra
parameters in the future like a signal, an extra context, etc