Skip to content

Commit 992b693

Browse files
committed
GET to POST only for SPA mode.
1 parent 141e3f1 commit 992b693

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Headlines: Added, Changed, Deprecated, Removed, Fixed, Security
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
12+
- The "GET to POST" modification for `use:enhance` was only intended for SPA mode to fully support progressive enhancement, so it now properly checks for that before adding the missing `method="POST"` attribute on the form.
13+
814
## [2.12.4] - 2024-04-09
915

1016
### Fixed

src/lib/client/superForm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ export function superForm<
14601460
* @DCI-context
14611461
*/
14621462
function superFormEnhance(FormElement: HTMLFormElement, events?: SuperFormEvents<T, M>) {
1463-
if (FormElement.method == 'get') FormElement.method = 'post';
1463+
if (options.SPA !== undefined && FormElement.method == 'get') FormElement.method = 'post';
14641464

14651465
if (typeof options.SPA === 'string') {
14661466
if (options.SPA.length && FormElement.action == document.location.href) {

src/routes/(v2)/v2/multistep-client/+page.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
<h3>Step {step}</h3>
4545

46-
<form use:enhance>
46+
<form method="POST" use:enhance>
4747
{#if step == 1}
4848
<label>
4949
Name<br />

0 commit comments

Comments
 (0)