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 ff6b183 commit e28a3cfCopy full SHA for e28a3cf
1 file changed
src/hooks/usePathHistory.ts
@@ -2,6 +2,7 @@ import { useCallback } from 'react'
2
3
const STORAGE_KEY = 'qbit-path-history'
4
const MAX_ENTRIES = 50
5
+const MAX_SUGGESTIONS = 5
6
7
function getHistory(): string[] {
8
try {
@@ -29,9 +30,9 @@ export function usePathHistory() {
29
30
31
const getSuggestions = useCallback((input: string): string[] => {
32
const history = getHistory()
- if (!input) return history.slice(0, 5)
33
+ if (!input) return history.slice(0, MAX_SUGGESTIONS)
34
const lower = input.toLowerCase()
- return history.filter((p) => p.toLowerCase().includes(lower))
35
+ return history.filter((p) => p.toLowerCase().includes(lower)).slice(0, MAX_SUGGESTIONS)
36
}, [])
37
38
return { addPath, getSuggestions }
0 commit comments