Skip to content

Commit 8c22a48

Browse files
committed
In rare cases, timers weren't resetted when redirecting to the same route.
1 parent f4feaea commit 8c22a48

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
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+
## [1.5.1] - 2023-08-09
9+
10+
### Fixed
11+
12+
- In rare cases, timers weren't resetted when redirecting to the same route.
13+
814
## [1.5.0] - 2023-07-23
915

1016
### Fixed

src/lib/client/formEnhance.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,20 @@ export function formEnhance<T extends AnyZodObject, M>(
477477
cancelFlash(options);
478478
}
479479

480-
// Redirect messages are handled in onDestroy and afterNavigate.
480+
// Redirect messages are handled in onDestroy and afterNavigate in client/form.ts.
481+
// Also fixing an edge case when timers weren't resetted when redirecting to the same route.
481482
if (cancelled || result.type != 'redirect') {
482483
htmlForm.completed(cancelled);
484+
} else if (
485+
result.type == 'redirect' &&
486+
new URL(
487+
result.location,
488+
/^https?:\/\//.test(result.location)
489+
? undefined
490+
: document.location.origin
491+
).pathname == document.location.pathname
492+
) {
493+
htmlForm.completed(true);
483494
}
484495
}
485496

0 commit comments

Comments
 (0)