When subscribing to the state in Nuxt v3 mutation.events is undefined in production.
See original GitHub issueNot entirely sure if this is expected behavior but this is something i came accross today.
Steps to reproduce the behavior
in app.vue
<script setup>
import { useUserStore } from '~/store/user'
const user = useUserStore()
user.$subscribe(async (mutation, state) => {
// undefined on builded/production
console.log(mutation.events);
})
</script>
<template>
<div class="h-screen">
<NuxtPage />
</div>
</template>
Expected behavior
mutation.events = {...}
an object with old value, new value and more details
Actual behavior
mutation.events = undefined
Additional information
Nuxt - 3.0.0-27296423.f3082ca
pinia - 2.0.4
Standard nuxt build and run with node .output/server/index.mjs
production vs dev build
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
When subscribing to the state in Nuxt v3 mutation.events is ...
Expected behavior. mutation.events = {...} an object with old value, new value and more details. Actual behavior. mutation.events = ...
Read more >Store directory - Nuxt
To get started, export the state as a function, and the getters, mutations and actions as objects.
Read more >Initial state from Nuxt Store is undefined when using SSR
I've created a Nuxt store for my index page with the intent of initializing the state and fetching some data from an API...
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
Nuxt was updated to a production-ready 1.0 version in January 2018 and is part ... However, this file only needs to export the...
Read more >Complex Vue 3 state management made easy with Pinia
Build a basic blog engine using Pinia, a state management tool for Vue apps, and its main features, including state, getters, and actions....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I understand 😆 They’re also in the docs where the search should be quite accurate https://pinia.esm.dev/api/interfaces/pinia.SubscriptionCallbackMutationPatchFunction.html#events
@posva ah! I see now Thank you and I’m sorry, i’m not working so much with all those fancy IDE features (yet). ( im a console log and documentation user. )