Skip to content

Commit

Permalink
fix(bridge-ui): fix issue with claim notice modal (#13507)
Browse files Browse the repository at this point in the history
  • Loading branch information
jscriptcoder authored Mar 30, 2023
1 parent f5f7b7e commit a3e38fa
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/bridge-ui/src/components/modals/NoticeModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
noShowAgainCheckbox = noShowAgainStorage;
});
function closeAndContinue() {
show = false;
onConfirm?.(noShowAgainCheckbox);
}
function onConfirmNotice() {
if (noShowAgainCheckbox) {
// If checkbox is checked, store it in localStorage so
Expand All @@ -29,9 +34,19 @@
noShowAgainStorage = true;
}
show = false;
closeAndContinue();
}
onConfirm?.(noShowAgainCheckbox);
// It could happen that the modal is being opened via prop, but the user
// already opted out of seeing the message (we have localStorage set).
// In that case, we still want to run the onConfirm callback, which contains
// the next steps in the flow, also setting the prop back to false
// (could be bound to the parent)
// TODO: use promises here. API to open the modal should return a promise
// which resolves when the user clicks on confirm. If noShowAgain is set
// to true, the promise should resolve immediately.
$: if (show && noShowAgainStorage) {
closeAndContinue();
}
</script>

Expand Down

0 comments on commit a3e38fa

Please sign in to comment.