Skip to content

Commit 4e8fd83

Browse files
committed
Only update locally on success
1 parent 3dd34a1 commit 4e8fd83

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/components/support-us/FundraisingProgress.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
target: progress,
1515
};
1616
} else {
17-
currentProgressTween = new Tween<number>(progress);
17+
currentProgressTween = new Tween<number>(progress, { duration: 700 });
1818
}
1919
let peopleCount = $state(currentPeopleCount);
2020
let currentProgress = $derived(Math.round(currentProgressTween.current));

src/components/support-us/SupportForm.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@
8181
delayed = false;
8282
timeout = false;
8383
submitting = false;
84-
document.querySelector('#logo')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
85-
showForm = false;
86-
setTimeout(() => {
87-
progressStore.update((v) => ({
88-
...v,
89-
amount: v.amount + formData.contribution,
90-
people: v.people + 1,
91-
}));
92-
}, 1000);
84+
if (submitResult !== 'success') {
85+
document.querySelector('#logo')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
86+
showForm = false;
87+
setTimeout(() => {
88+
progressStore.update((v) => ({
89+
...v,
90+
amount: v.amount + formData.contribution,
91+
people: v.people + 1,
92+
}));
93+
}, 1000);
94+
}
9395
}
9496
</script>
9597

0 commit comments

Comments
 (0)