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 { DocumentData } from 'firebase/firestore'
import { PrivateUser } from 'common/user' import { PrivateUser } from 'common/user'
import { import {
getUser,
listenForLogin, listenForLogin,
listenForPrivateUser, listenForPrivateUser,
listenForUser, listenForUser,
@ -54,11 +55,9 @@ export const useUserById = (userId: string) => {
const queryClient = new QueryClient() const queryClient = new QueryClient()
export const prefetchUser = (userId: string) => { export const prefetchUser = (userId: string) => {
queryClient.prefetchQuery(['users', userId]) queryClient.prefetchQuery(['users', userId], () => getUser(userId))
} }
export const prefetchUsers = (userIds: string[]) => { export const prefetchUsers = (userIds: string[]) => {
userIds.forEach((userId) => { userIds.forEach(prefetchUser)
queryClient.prefetchQuery(['users', userId])
})
} }