From a8e95f7debb47fa433a2b65ed3640d0326d1e545 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Sep 2026 17:41:31 +0200 Subject: [PATCH] Fix Fetch dropping repeated form fields and leaking src into history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two faults in the same resolver, both reported from a facet filter form. Folding a GET form onto the base URL used `set` per field, which keeps one value per name. A checkbox group is repeated names by design, so ticking a second box changed nothing: FormData held both values, `new URLSearchParams(FormData)` serialised both, and the request carried one. The fold now deletes the base's values the first time it meets a name and appends after that, which keeps the override `set` was there for and stops discarding the rest. History pushed the URL that was fetched, so a `src` pointing at a lighter endpoint put its own parameters in the address bar and in anything a visitor copied out of it. History now follows the element's own destination — a link's href, a form's action folded with its data — through a new `historyUrl` getter. A URL passed explicitly to `fetch()` is still pushed as given. Nothing changes for an element without `src`, where the two URLs are the same. --- CHANGELOG.md | 5 + packages/docs/reference/items/Fetch/js-api.md | 38 ++++- packages/tests/Fetch/Fetch.spec.ts | 133 ++++++++++++++++++ packages/ui/src/Fetch/Fetch.ts | 129 +++++++++++++---- 4 files changed, 280 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78030adc..41b61c54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - **@studiometa/ui-motion:** add a new `@studiometa/ui-motion` package with the `Motion`, `MotionScrollTimeline`, `MotionSequence` and `MotionView` components to animate elements declaratively with [Motion](https://motion.dev) ([#628](https://github.com/studiometa/ui/pull/628), [#629](https://github.com/studiometa/ui/pull/629), [#630](https://github.com/studiometa/ui/pull/630), [#633](https://github.com/studiometa/ui/pull/633), [#636](https://github.com/studiometa/ui/pull/636), [#637](https://github.com/studiometa/ui/pull/637), [#638](https://github.com/studiometa/ui/pull/638), [#640](https://github.com/studiometa/ui/pull/640), [#641](https://github.com/studiometa/ui/pull/641)) - **DataBind:** add the `data-bind:if` virtual binding to render `