File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/lib/components/SubmissionStatus Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 106106 // Cancel the default form submission.
107107 cancel ();
108108
109+ if (isSame (submissionStatus , taskResult )) {
110+ console .log (' Skipping: Submission status already set to' , submissionStatus .labelName );
111+
112+ resetDropdown ();
113+ return () => {};
114+ }
115+
109116 // Submit data manually using fetch API.
110117 fetch (action , {
111118 method: ' POST' ,
124131 errorMessageStore .setAndClearAfterTimeout (FAILED_TO_UPDATE_SUBMISSION_STATUS , 10000 );
125132 })
126133 .finally (() => {
127- closeDropdown ();
128- showForm = false ;
134+ resetDropdown ();
129135 });
130136
131137 // Do not change anything in SvelteKit.
132138 return () => {};
133139 };
134140 };
135141
142+ function isSame(submissionStatus : SubmissionStatus , taskResult : TaskResult ): boolean {
143+ return submissionStatus .innerName === taskResult .status_name ;
144+ }
145+
146+ function resetDropdown(): void {
147+ closeDropdown ();
148+ showForm = false ;
149+ }
150+
136151 function updateTaskResult(
137152 taskResult : TaskResult ,
138153 submissionStatus : SubmissionStatus ,
You can’t perform that action at this time.
0 commit comments