From 66cf69e4256bb694543d7ff92f2e335ccf00145d Mon Sep 17 00:00:00 2001 From: James Grugett Date: Tue, 7 Jun 2022 23:06:14 -0500 Subject: [PATCH] Fix react query console error --- web/hooks/use-user.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/hooks/use-user.ts b/web/hooks/use-user.ts index 7641f6e2..b57a0256 100644 --- a/web/hooks/use-user.ts +++ b/web/hooks/use-user.ts @@ -5,6 +5,7 @@ import { QueryClient } from 'react-query' import { DocumentData } from 'firebase/firestore' import { PrivateUser } from 'common/user' import { + getUser, listenForLogin, listenForPrivateUser, listenForUser, @@ -54,11 +55,9 @@ export const useUserById = (userId: string) => { const queryClient = new QueryClient() export const prefetchUser = (userId: string) => { - queryClient.prefetchQuery(['users', userId]) + queryClient.prefetchQuery(['users', userId], () => getUser(userId)) } export const prefetchUsers = (userIds: string[]) => { - userIds.forEach((userId) => { - queryClient.prefetchQuery(['users', userId]) - }) + userIds.forEach(prefetchUser) }