1
This commit is contained in:
1 parent
d5cae61861
commit
eb415cd0d0
33 files changed
+2642
-382
No files matched your search
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user