Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9cc6e92

Browse files
chore: memory leak prevented in use search hook
1 parent d34f873 commit 9cc6e92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/components/DiffViewer/hooks/useSearch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export function useSearch(leftView: DiffRowOrCollapsed[], initialTerm?: string,
5555
if (listContainer) {
5656
const handleScroll = () => setTimeout(() => highlightMatches(searchState.term, DIFF_VIEWER_CLASS), 100);
5757
listContainer.addEventListener("scroll", handleScroll);
58-
return () => listContainer.removeEventListener("scroll", handleScroll);
58+
return () => {
59+
observer.disconnect();
60+
listContainer.removeEventListener("scroll", handleScroll);
61+
};
5962
}
6063

6164
return () => observer.disconnect();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /