migration
byCodemod

Pinia Colada 0 14 Migration Recipe

/icons/calendar.svg

Last update

Mar 18, 2025

This codemod updates the usage of PiniaColada to ensure that the enabled and gcTime options are correctly placed under queryOptions. Previously, these options were directly passed as top-level properties, which is now deprecated. The codemod transforms these patterns into the new structure where enabled is nested under queryOptions.

Changes Applied:

  • Moves enabled under queryOptions
  • Moves gcTime under queryOptions if present
  • Ensures PiniaColada is always called with a valid configuration object

Before

app.use(PiniaColada, { plugins, enabled: () => true, pinia });
app.use(PiniaColada, { enabled: () => true, gcTime, pinia });

After

app.use(PiniaColada, { plugins, queryOptions: { enabled: () => true }, pinia });
app.use(PiniaColada, { plugins, pinia, queryOptions: { enabled: () => true, gcTime } });

Using this codemod

You can run this codemod with the following command:

npx codemod pinia-colada-0-14-migration-recipe

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now