Skip to content

Commit 99f03dc

Browse files
perf(web): the escape-to-go-back hook compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit 99f03dc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/web/src/hooks/useNavigateBack.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { useCanGoBack, useNavigate } from "@tanstack/react-router";
2-
import { useCallback, useEffect } from "react";
2+
import { useEffect } from "react";
33

44
function useNavigateBack() {
55
const navigate = useNavigate();
66
const canGoBack = useCanGoBack();
77

8-
return useCallback(() => {
8+
return () => {
99
if (canGoBack) {
1010
window.history.back();
1111
return;
1212
}
1313
void navigate({ to: "/" });
14-
}, [canGoBack, navigate]);
14+
};
1515
}
1616

1717
export function useEscapeToGoBack(onEscape?: () => void) {

0 commit comments

Comments
 (0)