Skip to content

Commit f37f1bd

Browse files
authored
Merge pull request #123 from blocknative/fix/resolve
Fix wallet checks never resolving. Closes #122
2 parents 573fb56 + 276ccee commit f37f1bd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/views/WalletCheck.svelte

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
let checkingModule: boolean = false
3535
let actionResolved: boolean | undefined = undefined
3636
let loading: boolean = false
37+
let loadingModal: boolean = false
3738
3839
// recheck modules if below conditions
3940
$: if (!activeModal && !checkingModule) {
@@ -122,11 +123,11 @@
122123
}
123124
124125
function handleExit() {
126+
resetState()
125127
app.update((store: AppState) => ({
126128
...store,
127129
walletCheckInProgress: false
128130
}))
129-
resetState()
130131
}
131132
132133
function resetState() {
@@ -138,6 +139,7 @@
138139
}
139140
140141
function runModules(modules: WalletCheckModule[]) {
142+
loadingModal = true
141143
return new Promise(
142144
async (
143145
resolve: (result: {
@@ -154,10 +156,12 @@
154156
const result = await invalidState(module, get(state))
155157
156158
if (result) {
159+
loadingModal = false
157160
return resolve(result)
158161
}
159162
}
160163
164+
loadingModal = false
161165
return resolve({ modal: undefined, module: undefined })
162166
}
163167
)
@@ -231,8 +235,14 @@
231235
}
232236
</style>
233237

234-
<Modal closeModal={handleExit} closeable={!!activeModal}>
235-
{#if activeModal}
238+
{#if loadingModal}
239+
<Modal closeable={false}>
240+
<Spinner />
241+
</Modal>
242+
{/if}
243+
244+
{#if activeModal}
245+
<Modal closeModal={handleExit}>
236246
<ModalHeader icon={activeModal.icon} heading={activeModal.heading} />
237247
<p class="bn-onboard-custom bn-onboard-prepare-description">
238248
{@html activeModal.description}
@@ -261,7 +271,5 @@
261271
{/if}
262272
<Button onclick={handleExit}>Dismiss</Button>
263273
</div>
264-
{:else}
265-
<Spinner />
266-
{/if}
267-
</Modal>
274+
</Modal>
275+
{/if}

0 commit comments

Comments
 (0)