prazdevs/pinia-plugin-persistedstate

新数据覆盖旧数据未生效

Closed this issue · 1 comments

Are you using Nuxt?

  • Check this box if you encountered the issue using Nuxt and the included module.

Describe the bug

在页面中使用 stroe(),xxx 可以覆盖旧数据,但是在源代码中重写数据不会自动覆盖 本地数据

原始
export const main = defineStore(
  "main",
  () => {
      const platform: { [key: number]: string } = reactive({
      1: "淘宝/天猫",
      2: "拼多多",
    })
新值  页面不会变化
export const main = defineStore(
  "main",
  () => {
      const platform: { [key: number]: string } = reactive({
      1: "淘宝/天猫",
      2: "拼多多123",
    })

在页面中使用 main().platform[1]=xxx 可以正常覆盖

Reproduction

123123

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 3.61 GB / 15.36 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.12.1 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (129.0.2792.65)

Used Package Manager

pnpm

Validations

Hi please provide a proper reproduction and steps so I can help/investigate the issue 🙏
Feel free to reopen when proper information is provided.

Side not, if what you are looking for is HMR, maybe refer to the docs in pinia.