fix(admin): replace navigation.retry() with goto() after flush

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 <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-10-07 18:34:56 -07:00
parent eebaf86b64
commit 8fa26fb39e
5 changed files with 20 additions and 5 deletions

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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')

View file

@ -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)
}

View file

@ -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)
}