All skills
skilld-dev avatar

/pinia-colada-skilld

@b9c39cb

Data fetching layer for Vue built on Pinia. Use when writing, debugging, or reviewing code that imports @pinia/colada (pinia colada), including useQuery, useMutation, useInfiniteQuery, defineQuery, query cache invalidation, optimistic updates, plugins, SSR, or migrating from older versions. Provides current 1.4.x APIs, patterns, and migration rules.

Use this Skill: https://skilld.dev/gh/skilld-dev/vue-ecosystem-skills/pinia-colada-skilld

This session only. Nothing lands on disk.

referencesssr.md

≈561 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Server-side rendering

@pinia/colada 1.4.5. SSR builds on Pinia's SSR story plus custom cache serialization.

Docs: https://pinia-colada.esm.dev/guide/ssr.md

Nuxt

The @pinia/colada-nuxt module handles serialization automatically. Install and configure it in nuxt.config.ts (https://pinia-colada.esm.dev/nuxt.md). In Nuxt, import useRoute from vue-router explicitly inside defineQuery files that use it; relying on auto-imports inside module context can trigger unnecessary fetches.

Custom SSR: serialize and hydrate

The query cache needs its own serialization. With devalue:

import devalue from 'devalue'
import { isQueryCache, serializeQueryCache, hydrateQueryCache, useQueryCache } from '@pinia/colada'

// server
const stringified = devalue.stringify(useQueryCache(pinia), {
  PiniaColada_TreeMapNode: (data: unknown) =>
    isQueryCache(data) && serializeQueryCache(data),
})

// client: install pinia and PiniaColada first, then
const revived = devalue.parse(stringified, {
  PiniaColada_TreeMapNode: data => data,
})
hydrateQueryCache(useQueryCache(pinia), revived)

Exports involved (dist/index.d.mts:390-427): isQueryCache, serializeQueryCache, hydrateQueryCache, isMutationCache.

Errors need their own serialization if you SSR them (see the devalue custom types guide and https://pinia-colada.esm.dev/guide/ssr.md).

Skipping queries on the server

useQuery({
  key: ['restaurants', { search: true }],
  query: () => findRestaurants(),
  enabled: typeof document !== 'undefined', // or !import.meta.env.SSR in Vite
})

To let a query fail softly during onServerPrefetch instead of failing the render, set ssrCatchError: true (dist/index.d.mts:482-487).

Avoid GC timers on the server

Use the bundled PiniaColadaSSRNoGc plugin (1.3.0) so pending setTimeout calls do not keep the Node process alive between requests:

app.use(PiniaColada, {
  plugins: import.meta.env.SSR ? [PiniaColadaSSRNoGc()] : [],
})

SSR-safe meta

meta is serialized during SSR. Keep it plain serializable data, or skip non-serializable values:

useQuery({
  key: ['user', id],
  query: () => fetchUser(id),
  meta: { errorMessage: 'Could not load user' },
})

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The Pinia Colada skill is a documentation-focused extension for Vue.js data fetching. It provides extensive references, best practices, and plugin guides. While no malicious behavior was detected, the skill includes explicit instructions designed to steer AI behavior and presents an indirect prompt injection surface by ingesting external community data from issues and discussions without protective boundaries.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at b9c39cb. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week

README badge

README badge for skilld-dev/vue-ecosystem-skills/pinia-colada-skilld