This commit is contained in:
zwgczx committed 2026-03-13 18:27:42 +08:00
1 parent d5cae61861
commit eb415cd0d0
33 files changed
+2642 -382

No files matched your search

+4 -3
View File
@@ -123,18 +123,19 @@ export default (config?: PiniaStorageConfig) => {
{ detached: true }
)
hydrating = true
void lf.getItem<Record<string, unknown>>(key)
.then(state => {
if (!state || typeof state !== 'object') return
// 若在异步hydrate返回前,store已被用户修改(如removeTab),不再回填旧缓存覆盖当前状态。
if (userMutatedBeforeHydrate) return
hydrating = true
context.store.$patch(state as any)
hydrating = false
})
.catch(error => {
hydrating = false
console.error('pinia hydrate failed:', error)
})
.finally(() => {
hydrating = false
})
}
}