Skip to content

Commit 20af9a9

Browse files
committed
revert router/client change in #931 (#936)
wakujs/waku#931 (comment)
1 parent 6e8364d commit 20af9a9

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

packages/waku/src/router/client.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -424,14 +424,8 @@ const InnerRouter = ({ routerData }: { routerData: RouterData }) => {
424424
};
425425
}, [changeRoute]);
426426

427-
const [routeFromServer, setRouteFromServer] = useState<
428-
{ path: string; query: string } | undefined
429-
>();
430427
useEffect(() => {
431-
if (routeFromServer) {
432-
// FIXME This feels too late to update the route from the server
433-
// Ideally, we should call `changeRoute` without useEffect.
434-
const { path, query } = routeFromServer;
428+
const callback = (path: string, query: string) => {
435429
const url = new URL(window.location.href);
436430
url.pathname = path;
437431
url.search = query;
@@ -447,11 +441,6 @@ const InnerRouter = ({ routerData }: { routerData: RouterData }) => {
447441
);
448442
}
449443
changeRoute(parseRoute(url), { skipRefetch: true });
450-
}
451-
}, [routeFromServer, changeRoute]);
452-
useEffect(() => {
453-
const callback = (path: string, query: string) => {
454-
setRouteFromServer({ path, query });
455444
};
456445
const listeners = (routerData[1] ||= new Set());
457446
listeners.add(callback);

0 commit comments

Comments
 (0)