Skip to content

Commit 34a8b38

Browse files
authored
Fix onboarding screen flashing on screen while extension initializes (#753)
1 parent e04af9f commit 34a8b38

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/components/Popup/MainBody.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
v-bind:entry="entry"
4040
v-bind:tabindex="getTabindex(entry)"
4141
/>
42-
<div class="no-entry" v-if="entries.length === 0">
42+
<div class="no-entry" v-if="entries.length === 0 && initComplete">
4343
<IconKey />
4444
<p>
4545
{{ i18n.no_entires }}
@@ -68,7 +68,7 @@ const computed: {
6868
shouldFilter: () => boolean;
6969
entries: () => OTPEntry[];
7070
} = {
71-
...mapState("accounts", ["filter", "showSearch"]),
71+
...mapState("accounts", ["filter", "showSearch", "initComplete"]),
7272
...mapGetters("accounts", ["shouldFilter", "entries"]),
7373
};
7474

src/definitions/module-interface.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ interface AccountsState {
7373
exportEncData: { [k: string]: OTPEntryInterface };
7474
key: { enc: string; hash: string } | null;
7575
wrongPassword: boolean;
76+
initComplete: boolean;
7677
}
7778

7879
interface NotificationState {

src/popup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ async function init() {
6969
instance.$store.commit("style/showInfo", true);
7070
instance.$store.commit("currentView/changeView", "EnterPasswordPage");
7171
}
72+
} else {
73+
// Set init complete if no encryption is present, otherwise this will be set in updateEntries.
74+
instance.$store.commit("accounts/initComplete");
7275
}
7376

7477
// Auto focus on first entry

src/store/Accounts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class Accounts implements Module {
2828
exportEncData: await EntryStorage.getExport(entries, true),
2929
key: await BrowserStorage.getKey(),
3030
wrongPassword: false,
31+
initComplete: false,
3132
},
3233
getters: {
3334
shouldFilter(
@@ -156,6 +157,9 @@ export class Accounts implements Module {
156157
wrongPassword(state: AccountsState) {
157158
state.wrongPassword = true;
158159
},
160+
initComplete(state: AccountsState) {
161+
state.initComplete = true;
162+
},
159163
},
160164
actions: {
161165
deleteCode: async (
@@ -435,6 +439,7 @@ export class Accounts implements Module {
435439
await EntryStorage.getExport(state.state.entries, true)
436440
);
437441
state.commit("updateKeyExport", await BrowserStorage.getKey());
442+
state.commit("initComplete");
438443
return;
439444
},
440445
clearFilter: (state: ActionContext<AccountsState, {}>) => {

0 commit comments

Comments
 (0)