We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aaa4add commit 624552fCopy full SHA for 624552f
packages/gitbook/src/components/Search/useSearchResultsCursor.ts
@@ -12,15 +12,12 @@ export function useSearchResultsCursor(props: { query: string; results: ResultTy
12
}
13
}, [query]);
14
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]);
+ React.useEffect(() => {
+ if (results.length > 0) {
+ // Auto-focus the first result
+ setCursor(0);
+ }
+ }, [results]);
24
25
const moveBy = React.useCallback(
26
(delta: number) => {
0 commit comments