Skip to content

fix: leads full-page reload and delete crash#19

Open
simpros wants to merge 3 commits intomainfrom
anvil/fix-leads-bugs
Open

fix: leads full-page reload and delete crash#19
simpros wants to merge 3 commits intomainfrom
anvil/fix-leads-bugs

Conversation

@simpros
Copy link
Owner

@simpros simpros commented Mar 25, 2026

Add svelte:boundary to the app layout to handle async pending/error states for remote function queries. Without this boundary, pages using $derived(await query()) would fail on full-page reload because there was nothing to catch the pending state during hydration.

Fix lead deletion crash by using submit().updates() (single-flight mutation with no queries) instead of bare submit(). The default auto-invalidation was re-running getLeadData() for the just-deleted lead, causing a 404 error before goto() could navigate away.

simpros and others added 3 commits March 25, 2026 15:11
Add <svelte:boundary> to the app layout to handle async pending/error
states for remote function queries. Without this boundary, pages using
$derived(await query()) would fail on full-page reload because there
was nothing to catch the pending state during hydration.

Fix lead deletion crash by using submit().updates() (single-flight
mutation with no queries) instead of bare submit(). The default
auto-invalidation was re-running getLeadData() for the just-deleted
lead, causing a 404 error before goto() could navigate away.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 12 new tests (263 total, 0 failures):

- Layout boundary structural tests (5): verify svelte:boundary exists
  with pending and failed snippets, and that children render inside it.
  Prevents accidental removal of the boundary.

- Lead detail page tests (7): verify page renders correctly, and
  critically test that deleteLead.enhance() calls submit().updates()
  (not bare submit()) to prevent auto-invalidation crash. Also tests
  navigation to /leads after delete and error handling on failure.

Enhance createFormMock to capture enhance callbacks via _enhanceCallback
property, and add issues() support to field proxy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion tests

Replace _enhanceCallback hack with DOM-based interactions and remove all
as-any casts to satisfy @typescript-eslint/no-explicit-any. Make
addFormApi generic to preserve Mock type through Object.assign. Improve
layout structural guard tests with regex matchers and better comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant