File tree Expand file tree Collapse file tree
src/frontend/src/routes/(needs_onboarding)/(navbar_and_footer)/upload Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 import { markdown_to_html } from ' $lib/markdown/markdown' ;
1111 import { Button } from ' $lib/components/ui/button' ;
1212 import { fly , fade } from ' svelte/transition' ;
13+ import { onMount } from ' svelte' ;
1314 import { CloudOff } from ' @lucide/svelte' ;
1415
1516 import Stage1 from ' ./stage_1.svelte' ;
221222 window .history .pushState ({ stage: UploadStage .Stage_3 }, ' ' );
222223 };
223224
224- const onReset = () => {
225+ const resetState = (historyMode : ' push ' | ' replace ' = ' push ' ) => {
225226 files = [];
226227 uploadResult = null ;
227228 stage = UploadStage .Stage_1 ;
228- window .history .pushState ({ stage: UploadStage .Stage_1 }, ' ' );
229+ dragCounter = 0 ;
230+ dragActive = false ;
231+ dragOverZone = false ;
232+ dragOverCard = false ;
233+ if (historyMode === ' replace' ) {
234+ window .history .replaceState ({ stage: UploadStage .Stage_1 }, ' ' );
235+ } else {
236+ window .history .pushState ({ stage: UploadStage .Stage_1 }, ' ' );
237+ }
238+ };
239+
240+ const onReset = () => {
241+ resetState (' push' );
229242 };
230243
231244 const handlePopState = (e : PopStateEvent ) => {
232245 stage = isWhichUploadStage (e .state ?.stage ) ? e .state .stage : UploadStage .Stage_1 ;
233246 };
247+
248+ onMount (() => {
249+ resetState (' replace' );
250+ });
234251 </script >
235252
236253<svelte:window
You can’t perform that action at this time.
0 commit comments