bump lighthouse throttle
This commit is contained in:
parent
e5b0c85747
commit
f63956a08b
1 changed files with 2 additions and 1 deletions
|
@ -46,6 +46,7 @@ export default function WunderBarSuggestions(props: Props) {
|
||||||
const inputRef: ElementRef<any> = React.useRef();
|
const inputRef: ElementRef<any> = React.useRef();
|
||||||
const isFocused = inputRef && inputRef.current && inputRef.current === document.activeElement;
|
const isFocused = inputRef && inputRef.current && inputRef.current === document.activeElement;
|
||||||
|
|
||||||
|
const THROTTLE_MS = 1000;
|
||||||
const {
|
const {
|
||||||
push,
|
push,
|
||||||
location: { search },
|
location: { search },
|
||||||
|
@ -53,7 +54,7 @@ export default function WunderBarSuggestions(props: Props) {
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
const queryFromUrl = urlParams.get('q') || '';
|
const queryFromUrl = urlParams.get('q') || '';
|
||||||
const [term, setTerm] = React.useState(queryFromUrl);
|
const [term, setTerm] = React.useState(queryFromUrl);
|
||||||
const throttledTerm = useThrottle(term, 500) || '';
|
const throttledTerm = useThrottle(term, THROTTLE_MS) || '';
|
||||||
const searchSize = isMobile ? 20 : 5;
|
const searchSize = isMobile ? 20 : 5;
|
||||||
const { results, loading } = useLighthouse(throttledTerm, showMature, searchSize);
|
const { results, loading } = useLighthouse(throttledTerm, showMature, searchSize);
|
||||||
const noResults = throttledTerm && !loading && results && results.length === 0;
|
const noResults = throttledTerm && !loading && results && results.length === 0;
|
||||||
|
|
Loading…
Reference in a new issue