diff --git a/components/Player/screens/queue.tsx b/components/Player/screens/queue.tsx index 3e598b3a..f6180be0 100644 --- a/components/Player/screens/queue.tsx +++ b/components/Player/screens/queue.tsx @@ -4,7 +4,7 @@ import { StackParamList } from "../../../components/types"; import { usePlayerContext } from "../../../player/provider"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import { FlatList } from "react-native"; -import { SafeAreaView, useSafeAreaFrame } from "react-native-safe-area-context"; +import { useSafeAreaFrame } from "react-native-safe-area-context"; export default function Queue({ navigation }: { navigation: NativeStackNavigationProp}): React.JSX.Element { diff --git a/components/Search/component.tsx b/components/Search/component.tsx index a72aaa18..12e39f10 100644 --- a/components/Search/component.tsx +++ b/components/Search/component.tsx @@ -23,16 +23,19 @@ export default function Search({ queryFn: () => fetchSearchResults(searchString) }) - const search = useCallback( - debounce(() => { - refetch(); - }, 750), - [] - ); + const search = (func : () => void, delay : number) => useCallback(() => { + + let timeout : NodeJS.Timeout; + + return () => { + clearTimeout(timeout); + timeout = setTimeout(() => func(), delay) + } + }, []); const handleSearchStringUpdate = (value: string | undefined) => { setSearchString(value) - search(); + search(refetch, 1000); } return (