Add Sonner-based notifications and UX polish
This commit is contained in:
@@ -30,7 +30,6 @@ export function FormSaveButton({
|
||||
formSelector,
|
||||
formSelectors,
|
||||
label = "Speichern",
|
||||
reloadDocumentOnSuccess = false,
|
||||
}: FormSaveButtonProps) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
@@ -280,12 +279,8 @@ export function FormSaveButton({
|
||||
}
|
||||
|
||||
pendingSubmissionRef.current = null;
|
||||
if (reloadDocumentOnSuccess) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
router.refresh();
|
||||
setIsSubmitting(false);
|
||||
dirtyFormsRef.current.delete(pendingSubmission.formId);
|
||||
|
||||
if (!searchParams.has("__saved")) {
|
||||
return;
|
||||
@@ -298,7 +293,7 @@ export function FormSaveButton({
|
||||
router.replace(nextQuery ? `${pathname}?${nextQuery}` : pathname, {
|
||||
scroll: false,
|
||||
});
|
||||
}, [currentUrl, pathname, reloadDocumentOnSuccess, router, searchParams]);
|
||||
}, [currentUrl, pathname, router, searchParams]);
|
||||
|
||||
return (
|
||||
<Button type="submit" form={activeFormId ?? undefined} disabled={!activeFormId || !isDirty || isSubmitting}>
|
||||
|
||||
Reference in New Issue
Block a user