From 8d3a345149841c47951113b935cdbb95b58129bd Mon Sep 17 00:00:00 2001 From: Jett Way Date: Fri, 29 May 2026 19:43:06 +0800 Subject: [PATCH 1/2] fix(ClientRouter): pass location.href as base to new URL() in GET form handler --- packages/astro/components/ClientRouter.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/components/ClientRouter.astro b/packages/astro/components/ClientRouter.astro index 57685589c4d6..511765ef30de 100644 --- a/packages/astro/components/ClientRouter.astro +++ b/packages/astro/components/ClientRouter.astro @@ -136,7 +136,7 @@ const { fallback = 'animate' } = Astro.props; const options: Options = { sourceElement: submitter ?? form }; if (method === 'get') { const params = new URLSearchParams(formData as any); - const url = new URL(action); + const url = new URL(action, location.href); url.search = params.toString(); action = url.toString(); } else { From cb8f1f94f22c436691ef2d86524b00248682a855 Mon Sep 17 00:00:00 2001 From: Jett Way Date: Fri, 29 May 2026 20:11:27 +0800 Subject: [PATCH 2/2] Create explicit-form-base-action.md --- .changeset/hot-brooms-sleep.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/hot-brooms-sleep.md diff --git a/.changeset/hot-brooms-sleep.md b/.changeset/hot-brooms-sleep.md new file mode 100644 index 000000000000..53f85d0ee5dd --- /dev/null +++ b/.changeset/hot-brooms-sleep.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fix TypeError when a GET form uses a relative `formaction` attribute with ClientRouter enabled