Skip to content

Commit 624552f

Browse files
committed
Remove comment
1 parent aaa4add commit 624552f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/gitbook/src/components/Search/useSearchResultsCursor.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ export function useSearchResultsCursor(props: { query: string; results: ResultTy
1212
}
1313
}, [query]);
1414

15-
// TODO: `results` is getting updated too often, causing the cursor to reset to 0 for every render.
16-
// Reimplement this once we have fixed that issue.
17-
18-
// React.useEffect(() => {
19-
// if (results.length > 0) {
20-
// // Auto-focus the first result
21-
// setCursor(0);
22-
// }
23-
// }, [results]);
15+
React.useEffect(() => {
16+
if (results.length > 0) {
17+
// Auto-focus the first result
18+
setCursor(0);
19+
}
20+
}, [results]);
2421

2522
const moveBy = React.useCallback(
2623
(delta: number) => {

0 commit comments

Comments
 (0)