diff --git a/src/index.ts b/src/index.ts index 4235d71..1dfafbd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -167,7 +167,8 @@ export class VuexPersistence implements PersistOptions { * See https://github.com/championswimmer/vuex-persist/pull/118#issuecomment-500914963 * @since 2.1.0 */ - (store as any).restored = ((this.restoreState(this.key, this.storage)) as Promise).then((savedState) => { + (store as any).restoredAll = (store as any).restoredAll || []; + (store as any).restoredAll.push((this.restoreState(this.key, this.storage) as Promise).then(savedState => { /** * If in strict mode, do only via mutation */ @@ -184,7 +185,8 @@ export class VuexPersistence implements PersistOptions { } }) this.subscribed = true - }) + })); + (store as any).restored = Promise.all((store as any).restoredAll); } } else {