Skip to content

0.7 to 0.8 Migration Guide

Plugins setup can't be async

VueVue
NuxtNuxt

Why this change?

This change helps fixing issues with access to app context asynchronously during the store initialization and makes the whole system more predictable and stable.

ts
export default definePlugin({
  name: 'my-rstore-plugin',

  async setup({ hook }) { 
  setup({ hook }) { 
    const stuff = await getAsyncStuff() 

    let stuff: Awaited<ReturnType<typeof getAsyncStuff>> 
    hook('init', async () => { 
      stuff = await getAsyncStuff() 
    }) 
  }
})

Update Nuxt

VueVue
NuxtNuxt

You need to update nuxt to >4.1.2 or ^3.19.2.

Released under the MIT License.

directus logodirectus logo