Skip to content

Calls Action.onSettled on null responses - #580

Closed
m-canton wants to merge 2 commits into
solidjs:nextfrom
m-canton:null-responses0
Closed

m-canton wants to merge 2 commits into
solidjs:nextfrom
m-canton:null-responses0

Conversation

@m-canton

@m-canton m-canton commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

It calls Action.onSettled on any response is needed to clear states changed by Action.onSubmit or before. Only redirects are excluded.

For example, it allows to close form dialogs on action completed.

@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 63dae9a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

ryansolid added a commit that referenced this pull request Jul 27, 2026
Void mutations, metadata-only responses, and redirects skipped the
settled hooks, so onSubmit state never cleared for actions returning
nothing. Every invocation now settles its hooks exactly once; the
submissions list still records only outcomes with a result or error.

Co-authored-by: Cursor <[email protected]>
@ryansolid

Copy link
Copy Markdown
Member

Fixed on next in e1c1ec4. Every invocation now settles its hooks exactly once — void mutations, metadata-only responses, and redirects included. We went one further than proposed: redirects also fire onSettled, so the contract is simply "one onSettled per invocation, no exceptions" (skipping it on redirect risks leaving stale onSubmit state — like an open dialog — sitting over the new page, since a navigation doesn't necessarily unmount UI rendered above the route tree).

The submissions book-keeping is unchanged and intentional: only outcomes with a result or an error enter the list, so the typical void mutation still leaves nothing behind for you to clear.

@ryansolid ryansolid closed this Jul 27, 2026
millette pushed a commit to millette/solid-router that referenced this pull request Nov 28, 2026
The live version signal carries the fetch stamp; an equal write is a
no-op, so a sweep landing before the clock ticked past the mount left the
surviving layout's consumer untold and painting stale. This was the coin
toss behind the redirect-revalidate tests (solidjs#580, solidjs#608, solidjs#606) failing under
load: mount and redirect within one ms. The sweep now always changes the
version; regression test freezes the clock so the same-ms case is the
only case.

Co-authored-by: Cursor <[email protected]>
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.

2 participants