Skip to content

Commit

Permalink
Revert "feat: make client router support view transitions"
Browse files Browse the repository at this point in the history
This reverts commit 4c6f0e8.
  • Loading branch information
pmelab committed Feb 4, 2025
1 parent 4c6f0e8 commit 2e1bd24
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions packages/waku/src/router/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,25 +349,17 @@ const InnerRouter = ({
const changeRoute: ChangeRoute = useCallback(
(route, options) => {
const { skipRefetch } = options || {};
const performChange = () => {
startTransition(() => {
if (!staticPathSet.has(route.path) && !skipRefetch) {
const rscPath = encodeRoutePath(route.path);
const rscParams = createRscParams(route.query);
refetch(rscPath, rscParams);
}
if (options.shouldScroll) {
handleScroll();
}
setRoute(route);
});
};

if ('startViewTransition' in document) {
document.startViewTransition(performChange);
} else {
performChange();
}
startTransition(() => {
if (!staticPathSet.has(route.path) && !skipRefetch) {
const rscPath = encodeRoutePath(route.path);
const rscParams = createRscParams(route.query);
refetch(rscPath, rscParams);
}
if (options.shouldScroll) {
handleScroll();
}
setRoute(route);
});
},
[refetch, staticPathSet],
);
Expand Down Expand Up @@ -411,11 +403,8 @@ const InnerRouter = ({
'',
url,
);
changeRoute(parseRoute(url), {
skipRefetch: true,
shouldScroll: false,
});
}
changeRoute(parseRoute(url), { skipRefetch: true, shouldScroll: false });
};
locationListeners.add(callback);
return () => {
Expand Down

0 comments on commit 2e1bd24

Please sign in to comment.