OreQr
OreQr4mo ago

Bug? useSuspenseQuery -> isFetching doesn't change

Hi everyone! I'm trying to do users data table in nextjs via tRPC useSuspenseQuery. When I change input in useSuspenseQuery then new data fetch but test2.isFetching doesn't update at all. When I do test function that invalidate query then test2.isFetching is updating to true while data is fetching. How can I get query isFetching when input change? This is a bug? My code:
const searchParams = Object.fromEntries(useSearchParams().entries())

const [[users, meta], test2] = api.admin.users.getUsers.useSuspenseQuery({
query: searchParams.q,
page: searchParams.page as number | undefined,
})

console.log("test123", test2.isFetching)

const utils = api.useUtils()
const test = async () => {
await utils.admin.users.getUsers.invalidate()
}
const searchParams = Object.fromEntries(useSearchParams().entries())

const [[users, meta], test2] = api.admin.users.getUsers.useSuspenseQuery({
query: searchParams.q,
page: searchParams.page as number | undefined,
})

console.log("test123", test2.isFetching)

const utils = api.useUtils()
const test = async () => {
await utils.admin.users.getUsers.invalidate()
}
0 Replies
No replies yetBe the first to reply to this messageJoin