question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When subscribing to the state in Nuxt v3 mutation.events is undefined in production.

See original GitHub issue

Not 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

Schermafbeelding 2021-11-28 om 10 36 22 Schermafbeelding 2021-11-28 om 10 36 37

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
posvacommented, Nov 28, 2021

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

1reaction
vanlingcommented, Nov 28, 2021

@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. )

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found