Packages

@pinia/colada

1.4.9 · 30 Oct 2026MIT207.8k / weekRepositoryHomepagenpmAtom feed

Your version

0.8.0

12 Aug 2024Where it was published

0.21.7 is the newest release of 0.8.x.

In short

13 breaking5 new4 internal

  • Breaking

    isFetching from useQuery() is renamed to isLoading to better reflect that it's connected to asyncStatus.

  • Breaking

    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.

  • Breaking

    plugins: The onSuccess, onError, and onSettled global hooks have been moved from PiniaPlugin to a Pinia Colada plugin: PiniaColadaQueryHooksPlugin

  • Breaking

    This feature splits up the status state into two different status properties:

  • Breaking

    status is now just for the data 'pending' | 'success' | 'error'

  • Breaking

    queryStatus tells if the query is still running or not with 'idle' | 'running'

  • Breaking

    refetch, refresh and similar methods now resolve the state property without rejecting. This is usually more convenient.

  • Breaking

    The QueryStatus type has been split into DataStateStatus and OperationStateStatus.

Release note

Breaking changes

  • Breaking

    isFetching from useQuery() is renamed to
    isLoading to better reflect that it's connected to asyncStatus.

  • Breaking

    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.

  • Breaking

    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() {},
    +    }),
    +  ],
     })
  • Breaking

    This feature splits up the status state into two
    different status properties:

  • Breaking

    status is now just for the data 'pending' | 'success' | 'error'

  • Breaking

    queryStatus tells if the query is still running or not with 'idle' | 'running'

  • Breaking

    refetch, refresh and similar methods now resolve
    the state property without rejecting. This is usually more convenient.

  • Breaking

    The QueryStatus type has been split into
    DataStateStatus and OperationStateStatus.

  • Breaking

    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

  • Breaking

    Refetch -> fetch

  • Breaking

    invalidateEntry -> invalidate

  • Breaking

    ensureEntry -> ensure

Their arguments have changed as well.

  • Breaking

    This release removes the deprecated QueryPlugin. Use
    PiniaColada instead.

Features

  • Add a state property to useQuery for type narrowing

  • mutation: refetch active queries

  • plugins: Refactor query global hooks into a plugin

  • query: add active property to query entry (994db63), closes #65

  • Split useMutation status like useQuery

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.