From 42737e570d6c1c46434183bd264d0334128b987c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Sun, 15 Nov 2020 02:34:22 +0100 Subject: [PATCH] refactor(frontend): remove unnecessary state in useApi hooks --- frontend/src/hooks/use-api.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/hooks/use-api.tsx b/frontend/src/hooks/use-api.tsx index 9d4513c..91c7089 100644 --- a/frontend/src/hooks/use-api.tsx +++ b/frontend/src/hooks/use-api.tsx @@ -31,8 +31,6 @@ export const useRecentListens = (options: PaginationOptions) => { export const useListensReport = (options: ListenReportOptions) => { const { client } = useApiClient(); - const [initialData] = useState(INITIAL_EMPTY_ARRAY); - const fetchData = useMemo(() => () => getListensReport(options, client), [ options, client, @@ -40,7 +38,7 @@ export const useListensReport = (options: ListenReportOptions) => { const { value: report, pending: isLoading, error } = useAsync( fetchData, - initialData + INITIAL_EMPTY_ARRAY ); return { report, isLoading, error }; @@ -49,8 +47,6 @@ export const useListensReport = (options: ListenReportOptions) => { export const useTopArtists = (options: TopArtistsOptions) => { const { client } = useApiClient(); - const [initialData] = useState(INITIAL_EMPTY_ARRAY); - const fetchData = useMemo(() => () => getTopArtists(options, client), [ options, client, @@ -58,7 +54,7 @@ export const useTopArtists = (options: TopArtistsOptions) => { const { value: topArtists, pending: isLoading, error } = useAsync( fetchData, - initialData + INITIAL_EMPTY_ARRAY ); return { topArtists, isLoading, error };