Skip to content

Commit e8af98c

Browse files
committed
fix(repo): reset code view when switching repositories
- Add useEffect hook to reset viewRef state on repository change - Prevents stale code view references when navigating between repos - Ensures clean state when repoName changes
1 parent fc65393 commit e8af98c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/frontend/src/pages/repo/RepoDetail.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export const RepoDetail: React.FC<RepoDetailProps> = ({
105105
const viewRef = useCodeViewStore((s) => s.viewRef);
106106
const setViewRef = useCodeViewStore((s) => s.setViewRef);
107107

108+
// Reset viewRef when switching to a different repository
109+
useEffect(() => {
110+
setViewRef("");
111+
}, [repoName, setViewRef]);
112+
108113
const displayName = (name: string) => name.replace(/\.git$/, "");
109114

110115
useEffect(() => {

0 commit comments

Comments
 (0)