pinia Questions

4

I can't access my routes from the store. There may be a good explanation for this. I use Vuejs3 and Pinia My store : import {defineStore} from 'pinia' import {useRoute} from "vue-router";...
Shope asked 24/2, 2022 at 9:11

3

Solved

Currently I am doing something like this to import stores in components import { useSomeStore } from "~/store/someStore"; const store = useSomeStore(); What I would like to achieve is sk...
Damnation asked 28/3, 2023 at 5:31

3

I'm trying to setup vitest + @vue/test-utils but I can't test some components that use ref(Vue) or useCookie (Nuxt), I have the same problem with Pinia as well where I import globally 2 functions i...
Pellikka asked 20/1, 2023 at 19:13

2

I am using pinia to manage state into my Vue3 app. There has been thorough discussion here to break pinia store into individual files like state, getters, actions. But I am looking for a more 'stab...
Inference asked 7/5, 2022 at 15:36

6

Solved

I am using Vue 3 including the Composition API and additionally Pinia as State Management. In the options API there is a method beforeRouteEnter, which is built into the component itself. Unfortuna...
Jessie asked 14/1, 2022 at 13:0

2

Solved

I have a store. export const useGameStore = defineStore("game", { state: () => gameBaseState, getters: { foundMarkers(state): Marker[] { return state.markers.filter((m) => m.fou...
Chadbourne asked 16/3, 2023 at 11:47

7

Solved

i get this error: Uncaught Error: [🍍]: getActivePinia was called with no active Pinia. Did you forget to install pinia? const pinia = createPinia() app.use(pinia) This will fail in production. at ...
Vday asked 19/2, 2023 at 3:15

3

Is it possible to store data locally in IndexedDB using Pinia ? I tried using Pinia persisted state and it stores data locally in LocalStorage as default. I just want to try if it will work with In...
Narvaez asked 12/12, 2022 at 20:55

3

I am developing an app using Vue 3, Vuetify 3, and Pinia, all of which I'm in the process of learning. I'm trying to follow this video to learn Pinia and at about 17:50, the presenter says to insta...
Insistence asked 9/11, 2023 at 22:11

4

I am testing pinia store in nuxt3 app. Inside setup() of store I'm using useRuntimeConfig to get initial value for counter from public config variables and I got this error ReferenceError: useRunti...
Belle asked 10/5, 2022 at 20:58

4

Solved

In my Vue app I am using several Pinia stores. For most of them, I need to initialize the state with data from a server, i.e. I need to wait for a server response. I'm trying to do this with Setup ...
Sinuous asked 5/11, 2023 at 20:23

3

I have a reactive value, which I want to store in a pinia store. const data = ref({}); async function loadData() { fetch("...") .then((res) => res.json()) .then((json) => (data.v...
Grillwork asked 2/5, 2022 at 11:11

1

Let's say I have a simple webshop application using Vue 3. Whenever the user adds an item to the cart, I store it locally in Pinia and I send this event information to the backend as well. By defau...
Capsulize asked 12/8, 2022 at 18:15

9

I am using pinia and vue-router 4.x ,but i am having a problem using both of them in a store. each works independently ,but not together. If i use import router from '../router' router will work b...
Formality asked 12/1, 2022 at 12:35

3

Solved

How can I get a reactive component that updates nested properties: I have a pinia store defined as follows import { defineStore } from "pinia" export const useStore = defineStore({ id: &...
Diverticulum asked 4/6, 2022 at 12:17

2

Solved

Is there a way to set custom auto imports in Nuxt 3? I use Pinia and my stores are in the root directory under /stores. For example, if I want to use the store from /stores/auth.store.ts in a compo...
Aranda asked 23/3, 2023 at 13:53

6

Solved

I setup Pinia on top of fresh Nuxt3 app and start dev server, with exactly these commands in order: npx nuxi init nuxt-app cd nuxt-app npm install npm install @pinia/nuxt npm run dev Dev server ru...
Bile asked 9/10, 2022 at 9:9

3

How can I type the returned 'data' from a useAsyncData call that fetches some data from a pinia store? <script setup lang="ts"> import { useSale } from "~/stores/sale"; c...
Unearned asked 18/4, 2023 at 20:59

4

Solved

In my application, i am working on storing user form responses. I have created pinia store and created each forms object. Using this store into my component and passing the getter function of that ...
Orlosky asked 31/5, 2023 at 6:30

3

Using a Pinia action from within the template in Vue3 gives Uncaught TypeError: $setup.[storeName].[actionName] is not a function Am I doing something wrong or is it expected behaviour. It doesn'...
Together asked 14/9, 2021 at 20:5

2

Solved

When trying to use an i18n message in a Nuxt3 Pinia store I get the error message: "SyntaxError: Must be called at the top of a setup function" When using a message in a template I can do...
Koumis asked 3/12, 2023 at 15:12

2

Solved

I have a pinia store action ("the Master Action") that mutates the store's state. This action is somewhat complicated, so i've broken it down into smaller "Child Actions" each o...
Anzac asked 29/4, 2023 at 20:8

1

Nuxt: 3.6.2 Pinia: 2.1.4 @pinia/nuxt: 0.4.11 While defining a Nuxt 3 plugin for Pinia I need to access the $pinia instance that exists on nuxtApp. The defineNuxtPlugin() function passes on argumen...
Gargoyle asked 11/7, 2023 at 22:25

2

Solved

I am using vue 3 with composition api and pinia I have an auth store that is reading from the store a default email and a default password import { useAuthStore } from "stores/auth"; cons...
Tylertylosis asked 20/1, 2023 at 9:35

4

I am trying to persist the state of a variable in a fresh Nuxt 3 app by using the package pinia-plugin-persistedstate. I've implemented the steps provided in the guide for nuxt 3: Created the /plu...
Fundament asked 15/8, 2022 at 14:18

© 2022 - 2024 — McMap. All rights reserved.