From b37af0c10594320b662a4b4c135d2e2bc28d6a7f Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 16 Feb 2023 14:35:54 -0600 Subject: [PATCH] Attempt to mitigate loading all packs on load - resolve type warnings - remove unused RegEx --- src/components/render/IconCatalog.tsx | 2 -- src/pages/index.tsx | 4 ++-- src/utils/getIcons.ts | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/render/IconCatalog.tsx b/src/components/render/IconCatalog.tsx index d2e2078..9956e91 100644 --- a/src/components/render/IconCatalog.tsx +++ b/src/components/render/IconCatalog.tsx @@ -1,8 +1,6 @@ import type {FunctionComponent} from "react"; import DisplayIconSingle from "@components/render/DisplayIconSingle"; -const regex = /^([A-Z][a-z]{1,})[A-Z]\w+$/; - type Props = { icons: { id: string, setId: string }[]; }; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 60422cf..3bfbab5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -23,7 +23,7 @@ const Home: NextPage = () => { const filtered = useMemo(() => { const start = new Date(); - const results = icons.filter(({id}) => id.toLowerCase().indexOf(query) !== -1); + const results = debouncedQuery.length == 0 ? [] : icons.filter(({id}) => id.toLowerCase().indexOf(query) !== -1); const end = new Date(); // const results = fuse.search(query, {limit: maximumResults}); @@ -33,7 +33,7 @@ const Home: NextPage = () => { }, [debouncedQuery]); const catalog = useMemo(() => { - return i).slice(0, 100)}/>; + return i).slice(0, 100)}/>; }, [filtered]); return ( diff --git a/src/utils/getIcons.ts b/src/utils/getIcons.ts index 06eb9d8..fcf9c0d 100644 --- a/src/utils/getIcons.ts +++ b/src/utils/getIcons.ts @@ -1,5 +1,5 @@ import codegen from "babel-plugin-codegen/macro"; -import {IconType} from "react-icons"; +import type {IconType} from "react-icons"; /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */ // language=JavaScript