diff --git a/src/lib/components/admin/EssayForm.svelte b/src/lib/components/admin/EssayForm.svelte index a5da324..b009774 100644 --- a/src/lib/components/admin/EssayForm.svelte +++ b/src/lib/components/admin/EssayForm.svelte @@ -173,7 +173,10 @@ $effect(() => { navigation.cancel() try { await autoSave.flush() - navigation.retry() + // Navigate to the intended destination after flush completes + if (navigation.to?.url) { + goto(navigation.to.url.pathname + navigation.to.url.search) + } } catch (error) { console.error('Autosave flush failed:', error) } diff --git a/src/lib/components/admin/PhotoPostForm.svelte b/src/lib/components/admin/PhotoPostForm.svelte index 3379da7..a1a2094 100644 --- a/src/lib/components/admin/PhotoPostForm.svelte +++ b/src/lib/components/admin/PhotoPostForm.svelte @@ -177,7 +177,10 @@ $effect(() => { navigation.cancel() try { await autoSave.flush() - navigation.retry() + // Navigate to the intended destination after flush completes + if (navigation.to?.url) { + goto(navigation.to.url.pathname + navigation.to.url.search) + } } catch (error) { console.error('Autosave flush failed:', error) } diff --git a/src/lib/components/admin/ProjectForm.svelte b/src/lib/components/admin/ProjectForm.svelte index 7af681b..5454b36 100644 --- a/src/lib/components/admin/ProjectForm.svelte +++ b/src/lib/components/admin/ProjectForm.svelte @@ -189,7 +189,10 @@ navigation.cancel() try { await autoSave.flush() - navigation.retry() + // Navigate to the intended destination after flush completes + if (navigation.to?.url) { + goto(navigation.to.url.pathname + navigation.to.url.search) + } } catch (error) { console.error('Autosave flush failed:', error) toast.error('Failed to save changes') diff --git a/src/lib/components/admin/SimplePostForm.svelte b/src/lib/components/admin/SimplePostForm.svelte index d1256ad..17481fb 100644 --- a/src/lib/components/admin/SimplePostForm.svelte +++ b/src/lib/components/admin/SimplePostForm.svelte @@ -178,7 +178,10 @@ beforeNavigate(async (navigation) => { navigation.cancel() try { await autoSave.flush() - navigation.retry() + // Navigate to the intended destination after flush completes + if (navigation.to?.url) { + goto(navigation.to.url.pathname + navigation.to.url.search) + } } catch (error) { console.error('Autosave flush failed:', error) } diff --git a/src/routes/admin/posts/[id]/edit/+page.svelte b/src/routes/admin/posts/[id]/edit/+page.svelte index 3b56202..c55f934 100644 --- a/src/routes/admin/posts/[id]/edit/+page.svelte +++ b/src/routes/admin/posts/[id]/edit/+page.svelte @@ -390,7 +390,10 @@ onMount(async () => { navigation.cancel() try { await autoSave.flush() - navigation.retry() + // Navigate to the intended destination after flush completes + if (navigation.to?.url) { + goto(navigation.to.url.pathname + navigation.to.url.search) + } } catch (error) { console.error('Autosave flush failed:', error) }