pl-fe: do not autosubmit search
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e1b7c25b0c
commit
7c1d237222
1 changed files with 1 additions and 7 deletions
|
@ -1,6 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import React, { useState } from 'react';
|
||||||
import React, { useCallback, useState } from 'react';
|
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useSearchParams } from 'react-router-dom-v5-compat';
|
import { useSearchParams } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
|
@ -21,15 +20,10 @@ const Search = () => {
|
||||||
setParams(params => ({ ...Object.fromEntries(params.entries()), q: value }));
|
setParams(params => ({ ...Object.fromEntries(params.entries()), q: value }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedSubmit = useCallback(debounce((value: string) => {
|
|
||||||
setQuery(value);
|
|
||||||
}, 900), []);
|
|
||||||
|
|
||||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const { value } = event.target;
|
const { value } = event.target;
|
||||||
|
|
||||||
setValue(value);
|
setValue(value);
|
||||||
debouncedSubmit(value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClear = (event: React.MouseEvent<HTMLDivElement>) => {
|
const handleClear = (event: React.MouseEvent<HTMLDivElement>) => {
|
||||||
|
|
Loading…
Reference in a new issue