diff --git a/src/app/tools/tankopedia/components/TankSearch/index.tsx b/src/app/tools/tankopedia/components/TankSearch/index.tsx index 277a61520..bf73c9634 100644 --- a/src/app/tools/tankopedia/components/TankSearch/index.tsx +++ b/src/app/tools/tankopedia/components/TankSearch/index.tsx @@ -47,9 +47,10 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) { const nations = use(NATIONS); const filters = useTankopediaPersistent((state) => state.filters); const sort = useTankopediaPersistent((state) => state.sort); - const awaitedTanks = use( - tanksDefinitionsArray.then((tanks) => - tanks + const awaitedTanks = use(tanksDefinitionsArray); + const defaultSortedTanks = useMemo( + () => + awaitedTanks .sort( (a, b) => treeTypeOrder.indexOf(a.treeType) - @@ -60,12 +61,12 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) { tankTypeOrder.indexOf(a.type) - tankTypeOrder.indexOf(b.type), ) .sort((a, b) => nations.indexOf(a.nation) - nations.indexOf(b.nation)), - ), + [], ); const input = useRef(null); const searchableTanks = useMemo( () => - awaitedTanks + defaultSortedTanks .filter( (tank) => (filters.tiers.length === 0 @@ -134,6 +135,7 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) { + - Loading...}> - { - router.push(`./tankopedia/${tank.id}`); - }} - /> - + { + router.push(`./tankopedia/${tank.id}`); + }} + /> ); }