Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using store outside setup(), state persistence is not possible #294

Open
4 tasks done
CCherry07 opened this issue Apr 2, 2024 · 1 comment
Open
4 tasks done

Using store outside setup(), state persistence is not possible #294

CCherry07 opened this issue Apr 2, 2024 · 1 comment
Labels
🔍️ pending triage This issue needs to be looked into

Comments

@CCherry07
Copy link

Describe the bug

code :

import { createPinia, defineStore } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
// config ->  {  persist: true }
export const createStore = <T>(storeId: string, defineSetup: () => T, config?: unknown) => {
  return () => defineStore(storeId, defineSetup, config)(pinia)
}

Reproduction

https://stackblitz.com/edit/vitejs-vite-6fthbm?file=package.json,src%2FApp.vue,src%2Fstore%2FuseCount.ts,vite.config.ts

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 183.73 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
    pnpm: 8.13.1 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 123.0.6312.87
    Edge: 123.0.2420.65
    Safari: 17.4.1

Used Package Manager

pnpm

Validations

@CCherry07 CCherry07 added the 🔍️ pending triage This issue needs to be looked into label Apr 2, 2024
@semiaddict
Copy link

Hi,
I seem to be experiencing a similar issue when using pinia globally via setActivePinia for web components.
Here's a repro: https://stackblitz.com/edit/vitejs-vite-7fdisv?file=src%2Fmain.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍️ pending triage This issue needs to be looked into
Projects
None yet
Development

No branches or pull requests

2 participants