Dev/issues 676 677
- **ciscoheat/sveltekit-superforms#676**: Bump `devalue` from `^5.6.1` to `^5.6.2` to resolve CVE-2026-22775 (resolves to 5.6.3)
- **ciscoheat/sveltekit-superforms#677**: Add a `processingEvents` guard to the `afterNavigate` hook in `form.ts` so that timers are not reset when `goto()` is called from within `onResult`/`onUpdate` handlers
## Notes on #677
I bumped into this as well; I suspect my SPA setup is a bit different from the setup of @sccunningham7 / the shared MRE, but AFAICT this is the same issue.
PR #624 added an `afterNavigate` hook that unconditionally calls `completed({ cancelled: false })` on every navigation, which was needed to reset form state after redirects from actions (#622)- this also fires when users call goto() from within form event handlers, prematurely resetting the submitting/delayed/timeout timers- haven't checked all handlers but I think this is uniform behavior.
To address this, I set the following:
- Set to `true` before `onResult`/`onUpdate` handlers run
- Set to `false` after they finish, but before `applyAction`/redirect handling
- `afterNavigate` only calls `completed()` when `processingEvents` is `false`
This preserves the #622 fix: redirects from form actions happen via `applyAction` which runs *after* `processingEvents` is reset to `false`, so `afterNavigate` still correctly resets timers for redirects.
Closes ciscoheat/sveltekit-superforms#676
Closes ciscoheat/sveltekit-superforms#677
## Tests
- [x] All existing tests pass (21 files, 424 tests including 4 new)
- [x] `svelte-check` reports 0 errors and 0 warnings
- [x] Unit tests verify `processingEvents` guard suppresses `afterNavigate` timer reset during event processing (`issue-677.test.ts`, 4 tests)
- [x] Unit tests verify #622 redirect path still resets timers (test: "should preserve the #622 fix")
- [ ] E2E verification with #677 MRE (requires live SvelteKit app — verify with [sveltelab MRE](https://www.sveltelab.dev/j839z38su646far)) - unsure about how exactly to test this or if it'd be worth building a e2e test, I actually have never used sveltelab 👀 I was iterating on a rolldown optimized subform in a scheduling application, nothing nearly as cool
### What tests do cover
| Test | Scenario |
|------|----------|
| `should reset timers when afterNavigate fires normally` | Baseline: afterNavigate resets timers when no event processing is active |
| `should NOT reset timers when processingEvents is true` | Core #677 fix: goto() from onUpdate suppressed |
| `should resume resetting timers after processingEvents is cleared` | Toggle: suppressed during processing, allowed after |
| `should preserve the #622 fix` | Redirect case: events finish → processingEvents cleared → afterNavigate resets normally |
### Fix from a Rolldown/Vite 8 perspective:
Resolvable via synchronous boolean flag
合并状态:未合并 2 条评论