File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
src/routes/projects/[projectId]/workflows/[workflowId] Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 22 import { onMount } from ' svelte' ;
33 import { writable } from ' svelte/store' ;
44 import { enhance } from ' $app/forms' ;
5- import { goto } from ' $app/navigation' ;
5+ import { goto , beforeNavigate } from ' $app/navigation' ;
66 import { page } from ' $app/stores' ;
77 import ArgumentForm from ' $lib/components/workflow/ArgumentForm.svelte' ;
88 import ConfirmActionButton from ' $lib/components/common/ConfirmActionButton.svelte' ;
4646 datasets = $page .data .datasets ;
4747 });
4848
49- // Add an event listener for the 'beforeunload' event
50- window .addEventListener (' beforeunload' , function (e ) {
49+ beforeNavigate ((navigation ) => {
5150 if (argumentsWithUnsavedChanges === true ) {
52- // Cancel the event
53- e . preventDefault ();
51+ // Prevent navigation
52+ navigation . cancel ();
5453 // Toggle the modal
5554 toggleUnsavedChangesModal ();
56- // Chrome requires returnValue to be set
57- e .returnValue = ' ' ;
5855 }
5956 });
6057
You can’t perform that action at this time.
0 commit comments