Skip to content

fix(partials): keep GET form values in the page URL - #3902

Open
limkaa4 wants to merge 1 commit into
freshframework:mainfrom
limkaa4:fix/form-submit-url-params
Open

fix(partials): keep GET form values in the page URL#3902
limkaa4 wants to merge 1 commit into
freshframework:mainfrom
limkaa4:fix/form-submit-url-params

Conversation

@limkaa4

@limkaa4 limkaa4 commented Sep 12, 2026

Copy link
Copy Markdown

What happens now

Submitting a GET form inside f-client-nav updates the partial, but the
address bar keeps the bare action — the submitted values are gone from it.

<div f-client-nav>
  <form action="/">
    <input type="hidden" name="name" value="foo" />
    <button type="submit">update</button>
  </form>
  <Partial name="foo"></Partial>
</div>
URL after submit
native form (no JS) /?name=foo
Fresh partial navigation /

The partial itself receives the values — only the page URL does not reflect them.

Why it matters

The state a user just produced is no longer in the URL, so it is lost on
reload, cannot be copied or bookmarked, and does not survive back/forward.
For apps that keep UI state in the URL — filters, search, sorting — the same
form behaves differently depending on whether JS is running, which defeats
progressive enhancement.

Cause

Both URLs start from the same action when no f-partial is given:

const rawPartialUrl =  ?? el.getAttribute(PARTIAL_ATTR) ?? el.action;
const rawActionUrl  =  ?? el.action;

The form fields are then appended to partialUrl only, while actionUrl is
what fetchPartials writes into history. So the two drift apart even though
nothing asked them to.

Change

Append the fields to the navigated URL as well. With f-partial the split
between "page URL" and "data URL" is preserved — only the page URL now carries
the submitted values, as a native navigation would.

Tests

Added partials - form submit puts values into the page url: submits a GET
form, asserts the URL equals /?name=foo, and checks island state survives, so
the assertion cannot be satisfied by a full page reload. It fails on main and
passes with this change. All existing partials tests pass unchanged.


🤖 Generated with Claude Code

Submitting a GET form inside `f-client-nav` updated the partial but left the
address bar at the bare `action`, so the submitted values disappeared from the
URL. A native form navigation puts them there, and apps that keep UI state in
the URL lose that state on reload, when copying the link, and on back/forward.

When no `f-partial` is given, both URLs start from the same `action`, but the
form fields were appended only to the URL used for fetching. Append them to the
navigated URL as well. With `f-partial` the split between the page URL and the
data URL is preserved.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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