Packages

@pinia/colada

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

Your version

0.16.0

21 May 2025Where it was published

0.21.7 is the newest release of 0.16.x.

In short

3 breaking6 new5 fixed2 internal

  • Breaking

    query: queryCache.invalidateQueries() now accepts a second parameter to control whether to refetch or not active queries. It can be set to 'all' to force fetch all queries. This replaces the existing behavior of passing active: null (can be removed now) which wasn't actually working. You shouldn't be negatively affected by this change as it wasn't working previously.

  • Breaking

    The internal cache structure has been refactored to be simpler, faster and smaller. Keys now support deeply nested objects and partially matches them when filtering (e.g. queryCache.getEntries()). To achieve this, the hydrated version of the cache has changed. serializeTreeMap has been removed but serializeQueryCache (which should be preferred) has been kept. EntryNodeKey and TreeMapNode (internals) have been removed. EntryNodeKey was just string | number. toCacheKey has been adapted and now returns a plain string rather than an array. This also fixed queryCache.getEntries(['1']) actually returning entries defined with a numeric key ([1]). The type for key is now stricter to ensure everything works well at the type level, you might notice it doesn't allow undefined as a value (except in objects), this is intended as the serialized version (JSON) transforms it no null, and will not match in the cache if used, if you want an nullish value, use null. The documentation has been updated to reflect this

  • Breaking

    types: If you built a plugin, you will have to rename the type params of generics like UseQueryEntryExtensions from TResult to TData. Otherwise, this change won't affect you.

Release note

This is the biggest release to date! Many bug fixes, typed keys, a lighter and faster build!

Breaking changes

  • Breaking

    query: queryCache.invalidateQueries() now accepts a second parameter to control whether to refetch or not active queries. It can be set to 'all' to force fetch all queries. This replaces the existing behavior of passing active: null (can be removed now) which wasn't actually working. You shouldn't be negatively affected by this change as it wasn't working previously.

  • Breaking

    The internal cache structure has been refactored to be simpler, faster and smaller. Keys now support deeply nested objects and partially matches them when filtering (e.g. queryCache.getEntries()). To achieve this, the hydrated version of the cache has changed. serializeTreeMap has been removed but serializeQueryCache (which should be preferred) has been kept. EntryNodeKey and TreeMapNode (internals) have been removed. EntryNodeKey was just string | number. toCacheKey has been adapted and now returns a plain string rather than an array. This also fixed queryCache.getEntries(['1']) actually returning entries defined with a numeric key ([1]). The type for key is now stricter to ensure everything works well at the type level, you might notice it doesn't allow undefined as a value (except in objects), this is intended as the serialized version (JSON) transforms it no null, and will not match in the cache if used, if you want an nullish value, use null. The documentation has been updated to reflect this

  • Breaking

    types: If you built a plugin, you will have to rename the type params of generics like UseQueryEntryExtensions from TResult to TData. Otherwise, this change won't affect you.

Features

  • Allow deeply nested structured keys (59227a8), closes #149

  • query: allow dynamic typed keys

  • query: allow for typed query keys

  • queryCache.setQueriesData

  • types: explicit types for useInfiniteQuery

  • types: stricter keys

Bug Fixes

  • Avoid fetch with initialData

  • query: gc entries created through dynamic useQuery in defineQuery

  • query: invalidate inactive queries too (cf5a790), closes #287

  • query: restore reactivity after unmounting defineQuery (dc2315a), closes #290

  • types: make key types stricter

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.