From f81b1fb539b042afb5d5e71bc1334c838a44aaab Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Fri, 1 Oct 2021 19:10:37 -0500 Subject: [PATCH] Fix onboarding screen flashing on screen while extension initializes. Noticeable with encrypted accounts. --- src/components/Popup/MainBody.vue | 4 ++-- src/definitions/module-interface.d.ts | 1 + src/popup.ts | 3 +++ src/store/Accounts.ts | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/Popup/MainBody.vue b/src/components/Popup/MainBody.vue index 0feef2217..4e8c4e92d 100644 --- a/src/components/Popup/MainBody.vue +++ b/src/components/Popup/MainBody.vue @@ -39,7 +39,7 @@ v-bind:entry="entry" v-bind:tabindex="getTabindex(entry)" /> -
+

{{ i18n.no_entires }} @@ -68,7 +68,7 @@ const computed: { shouldFilter: () => boolean; entries: () => OTPEntry[]; } = { - ...mapState("accounts", ["filter", "showSearch"]), + ...mapState("accounts", ["filter", "showSearch", "initComplete"]), ...mapGetters("accounts", ["shouldFilter", "entries"]), }; diff --git a/src/definitions/module-interface.d.ts b/src/definitions/module-interface.d.ts index 5eaf87c08..21d84639d 100644 --- a/src/definitions/module-interface.d.ts +++ b/src/definitions/module-interface.d.ts @@ -73,6 +73,7 @@ interface AccountsState { exportEncData: { [k: string]: OTPEntryInterface }; key: { enc: string; hash: string } | null; wrongPassword: boolean; + initComplete: boolean; } interface NotificationState { diff --git a/src/popup.ts b/src/popup.ts index 465361ad0..11cf51f12 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -69,6 +69,9 @@ async function init() { instance.$store.commit("style/showInfo", true); instance.$store.commit("currentView/changeView", "EnterPasswordPage"); } + } else { + // Set init complete if no encryption is present, otherwise this will be set in updateEntries. + instance.$store.commit("accounts/initComplete"); } // Auto focus on first entry diff --git a/src/store/Accounts.ts b/src/store/Accounts.ts index 2ee045b99..f74d1d198 100644 --- a/src/store/Accounts.ts +++ b/src/store/Accounts.ts @@ -28,6 +28,7 @@ export class Accounts implements Module { exportEncData: await EntryStorage.getExport(entries, true), key: await BrowserStorage.getKey(), wrongPassword: false, + initComplete: false, }, getters: { shouldFilter( @@ -156,6 +157,9 @@ export class Accounts implements Module { wrongPassword(state: AccountsState) { state.wrongPassword = true; }, + initComplete(state: AccountsState) { + state.initComplete = true; + }, }, actions: { deleteCode: async ( @@ -435,6 +439,7 @@ export class Accounts implements Module { await EntryStorage.getExport(state.state.entries, true) ); state.commit("updateKeyExport", await BrowserStorage.getKey()); + state.commit("initComplete"); return; }, clearFilter: (state: ActionContext) => {