vuejs / pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
https://pinia.vuejs.org
MIT License
12.91k stars 1.02k forks source link

undefined is not an object (evaluating 'pinia._s.has'),TypeError, useStore #2544

Closed jmastiholimath closed 8 months ago

jmastiholimath commented 8 months ago

Reproduction

production

Steps to reproduce the bug

Vue 3.3.6 Pinia 2.1.7

main.ts file import { createPinia } from "pinia"; const pinia = createPinia(); app.use(createPinia());

detail.vue import { DetailPageStore } from "@/stores/page-detail"; const detailPageStore = DetailPageStore(); detailPageStore.showPage('DetailPage');

detailPageStore.ts import { defineStore } from "pinia";

export const detailPageStore = defineStore({ id: "detail-page", state: (): DetailPageState => ({ pageName: null, }), actions: {

showDetailPage(pageName: string, data: any | null)
{

},

hideDetailPage() {

}

} });

currently getting undefined is not an object (evaluating 'pinia._s.has'),TypeError, useStore only on IOS and MAC devices function useStore(pinia, hot) { const hasContext = hasInjectionContext(); pinia = // in test mode, ignore the argument provided as we can always retrieve a // pinia instance with getActivePinia() pinia || (hasContext ? inject(piniaSymbol, null) : null); if (pinia) setActivePinia(pinia); pinia = activePinia; if (!pinia._s.has(id)) { if (isSetupStore) { createSetupStore(id, setup, options, pinia); } else { createOptionsStore(id, options, pinia); } }

Expected behavior

should not throw error

Actual behavior

currently throwing error undefined is not an object (evaluating 'pinia._s.has'),TypeError, useStore

Additional information

No response