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:
@@ -15,6 +15,9 @@ import {
|
||||
} from 'util/language';
|
||||
import useLocalStorage from 'util/useLocalStorage';
|
||||
import LoadingPlaceholder from 'components/util/LoadingPlaceholder';
|
||||
import { IconButton } from '@mui/material';
|
||||
import TravelExploreIcon from '@mui/icons-material/TravelExplore';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
function sourceToLangList(sources: ISource[]) {
|
||||
const result: string[] = [];
|
||||
@@ -46,6 +49,8 @@ export default function Sources() {
|
||||
const [sources, setSources] = useState<ISource[]>([]);
|
||||
const [fetched, setFetched] = useState<boolean>(false);
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
// make sure all of forcedDefaultLangs() exists in shownLangs
|
||||
sourceForcedDefaultLangs().forEach((forcedLang) => {
|
||||
@@ -65,12 +70,20 @@ export default function Sources() {
|
||||
useEffect(() => {
|
||||
setTitle('Sources');
|
||||
setAction(
|
||||
<LangSelect
|
||||
shownLangs={shownLangs}
|
||||
setShownLangs={setShownLangs}
|
||||
allLangs={sourceToLangList(sources)}
|
||||
forcedLangs={sourceForcedDefaultLangs()}
|
||||
/>,
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => history.push('/sources/all/search/')}
|
||||
size="large"
|
||||
>
|
||||
<TravelExploreIcon />
|
||||
</IconButton>
|
||||
<LangSelect
|
||||
shownLangs={shownLangs}
|
||||
setShownLangs={setShownLangs}
|
||||
allLangs={sourceToLangList(sources)}
|
||||
forcedLangs={sourceForcedDefaultLangs()}
|
||||
/>
|
||||
</>,
|
||||
);
|
||||
}, [shownLangs, sources]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user