From 8fa26fb39eb012ef545e55aa40b646e8737f4e8e Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 7 Oct 2025 18:34:56 -0700 Subject: [PATCH] fix(admin): replace navigation.retry() with goto() after flush MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed navigation guards in all forms that were calling the non-existent navigation.retry() method. After canceling navigation and flushing autosave, now properly uses goto() to navigate to the intended destination. Files fixed: - ProjectForm.svelte - EssayForm.svelte - PhotoPostForm.svelte - SimplePostForm.svelte - posts/[id]/edit/+page.svelte 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/components/admin/EssayForm.svelte | 5 ++++- src/lib/components/admin/PhotoPostForm.svelte | 5 ++++- src/lib/components/admin/ProjectForm.svelte | 5 ++++- src/lib/components/admin/SimplePostForm.svelte | 5 ++++- src/routes/admin/posts/[id]/edit/+page.svelte | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) 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) }