mass search (#157)
* mass search currently cripples server for like 2 mins on use * works its slow, really slow but it don't break the server anymore * concurrency using p-queue * remove package.lock + search auto select * sorting like yomi * fix yarn.lock
This commit is contained in:
@@ -12,7 +12,16 @@ import { IconButton, Input } from '@mui/material';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import { useQueryParam, StringParam } from 'use-query-params';
|
||||
|
||||
export default function AppbarSearch() {
|
||||
interface IProps {
|
||||
autoOpen?: boolean
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
autoOpen: false,
|
||||
};
|
||||
|
||||
const AppbarSearch: React.FunctionComponent<IProps> = (props) => {
|
||||
const { autoOpen } = props;
|
||||
const [query, setQuery] = useQueryParam('query', StringParam);
|
||||
const [searchOpen, setSearchOpen] = useState(!!query);
|
||||
const inputRef = React.useRef<HTMLInputElement>();
|
||||
@@ -40,6 +49,12 @@ export default function AppbarSearch() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (autoOpen) {
|
||||
openSearch();
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('keydown', handleSearchShortcut);
|
||||
|
||||
@@ -72,4 +87,8 @@ export default function AppbarSearch() {
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
AppbarSearch.defaultProps = defaultProps;
|
||||
|
||||
export default AppbarSearch;
|
||||
|
||||
Reference in New Issue
Block a user