fix(background-store): rename store id to avoid collision with stage-layouts

This commit is contained in:
RainbowBird
2026-04-25 17:05:41 +08:00
parent bc030812d3
commit 7312e471bc
+10 -1
View File
@@ -35,7 +35,16 @@ const BUILTIN_BACKGROUNDS = [
},
]
export const useBackgroundStore = defineStore('background', () => {
// NOTICE:
// id is `background-entries` (not `background`) to avoid colliding with
// stage-layouts' `defineStore('background', ...)` — Pinia uses the string id
// as a global singleton key, so two stores with the same id resolve to
// whichever was registered first at runtime (TS cannot detect this since the
// shape is inferred per-module).
// Source: packages/stage-layouts/src/stores/background.ts.
// Removal condition: when this store is merged with stage-layouts' store, or
// the string id collision is enforced at the type level.
export const useBackgroundStore = defineStore('background-entries', () => {
const STORAGE_PREFIX = 'bg-'
const entries = ref<Map<string, BackgroundEntry>>(new Map())