Skip to content

Commit

Permalink
fix(frontend): fixes confirmation handling (#4119)
Browse files Browse the repository at this point in the history
# Motivation

After a frontend calculation which sets the page into a `dirty` state
(which means that a confirm message is displayed if the user tries to
navigate) the state is not reseted correctly. This leads to the unwanted
behaviour that every time a user tries to reload the page, a confirm
message is displayed.

# Changes

- fixes state handling

# Tests

Every time the `browser refresh` button is clicked and the page is not
reloading, following message is displayed (it's not visible in the
video):
<img width="755" alt="image"
src="https://github.com/user-attachments/assets/d5fc15e0-83de-4e8f-ab2a-49a555ff95e7"
/>

This should only happen if the sending process is going on and in every
other case the page should reload instead of showing this message.


**before:**


https://github.com/user-attachments/assets/3ae4fd04-f9ac-45ee-9eb0-91c578878d89



**after:**



https://github.com/user-attachments/assets/ea41e773-31af-41a9-996d-a1af96286f30

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
BonomoAlessandro and github-actions[bot] authored Jan 8, 2025
1 parent 273505d commit 307eb61
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/frontend/src/lib/components/ui/InProgressWizard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
export let steps: ProgressSteps;
export let warningType: 'transaction' | 'manage' = 'transaction';
const startConfirmToClose = () => dirtyWizardState.set(true);
const stopConfirmToClose = () => dirtyWizardState.set(false);
$: confirmToCloseBrowser($dirtyWizardState);
const startConfirmToClose = () => {
dirtyWizardState.set(true);
confirmToCloseBrowser(true);
};
const stopConfirmToClose = () => {
dirtyWizardState.set(false);
confirmToCloseBrowser(false);
};
onMount(startConfirmToClose);
onDestroy(stopConfirmToClose);
Expand Down

0 comments on commit 307eb61

Please sign in to comment.