Fix react query console error

This commit is contained in:
James Grugett 2022-06-07 23:06:14 -05:00
parent 879ab272e0
commit 66cf69e425

View File

@ -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)
}