Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Using Pinia store in component fails when app is run in dev server

I'm using Pinia for state management in a Vue 2 application, and when I start the dev server and visit localhost:8080 I get the following error:

[Vue warn]: Error in render: "TypeError: this.IssueStore is undefined"

found in

---> <ATable> at src/components/AlertTable/main.vue
       <Inbox> at src/views/AlertInbox.vue
         <MMApp> at src/components/App/main.vue
           <App> at src/App.vue
             <Root>

Followed by a console log: 🍍 "IssueStore" store installed

So it seems like the component is using the store before Pinia is ready. If I then make an update to a component within the project, which triggers the dev server to recompile, everything works as expected.

Here is the store - some code has been removed:

export const useIssueStore = defineStore('IssueStore', {
  state: () => {
    return {
      issues: [],
    };
  },
  getters: {
    ...
    }
  },
  actions: {
    ...
  }
});

Here is the component that throws the error:

<template>
  <Table :columns="columns" :rows="getIssues" :selectable="true" />
</template>
     
<script>
import { useIssueStore } from '@/stores/IssueStore';
import { mapStores } from 'pinia'
import { Table } from '@/components';
          
export default {
  name: 'ATable',
  components: {
    Table
  },
  data() {
    return {
      columns: [],
    }
  },
  computed: {
    ...mapStores(useIssueStore),
    getIssues() {
      return this.IssueStore.filteredIssues;
    }
  },
}
</script>

This is main.js:

import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import { createPinia, PiniaVuePlugin, setMapStoreSuffix } from "pinia";

import VueCompositionAPI from "@vue/composition-api";
Vue.config.productionTip = false;

Vue.use(PiniaVuePlugin);
const pinia = createPinia();
setMapStoreSuffix('');

Vue.use(VueCompositionAPI);

new Vue({
  pinia,
  router,
  render: (h) => h(App),
}).$mount("#app");

Any thoughts on what may be causing this?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda