Skip to content

Commit 3295502

Browse files
committed
cancel hydration for all navigations
1 parent bc3d8e3 commit 3295502

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

.changeset/proud-ants-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
fix hydration cancellation on browser events

src/data/events.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { delegateEvents } from "solid-js/web";
2-
import { onCleanup, sharedConfig } from "solid-js";
2+
import { onCleanup } from "solid-js";
33
import type { RouterContext } from "../types.js";
44
import { actions } from "./action.js";
55
import { mockBase } from "../utils.js";
@@ -64,7 +64,6 @@ export function setupNativeEvents(
6464
const state = a.getAttribute("state");
6565

6666
evt.preventDefault();
67-
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = true;
6867
navigateFromRoute(to, {
6968
resolve: false,
7069
replace: a.hasAttribute("replace"),

src/routers/createRouter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Signal, createSignal, onCleanup } from "solid-js";
1+
import { type Signal, createSignal, onCleanup, sharedConfig } from "solid-js";
22
import type { LocationChange, RouterContext, RouterUtils } from "../types.ts";
33
import { createRouterComponent } from "./components.jsx";
44

@@ -38,6 +38,7 @@ export function createRouter(config: {
3838
undefined,
3939
next => {
4040
!ignore && config.set(next);
41+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = true;
4142
return next;
4243
}
4344
) as Signal<LocationChange>;

0 commit comments

Comments
 (0)