bigsexy
bigsexy
TTCTheo's Typesafe Cult
Created by karlosos on 10/1/2022 in #questions
trpc v10 Invalidating all queries from given router
thanks for the heads up. this would tripped me up when i migrate to v10
12 replies
TTCTheo's Typesafe Cult
Created by karlosos on 10/1/2022 in #questions
trpc v10 Invalidating all queries from given router
you might not be able to do it all in one line without breaking react hook rules. might have to do something like
const queryContext = trpc.useContext()
const queryContext = trpc.useContext()
first
12 replies
TTCTheo's Typesafe Cult
Created by karlosos on 10/1/2022 in #questions
trpc v10 Invalidating all queries from given router
u can do something like this to invalidate every query under user router.
12 replies
TTCTheo's Typesafe Cult
Created by karlosos on 10/1/2022 in #questions
trpc v10 Invalidating all queries from given router
trpc.useContext().queryClient.invalidateQueries({
predicate: (query) => query.queryKey.includes("user."),
});
trpc.useContext().queryClient.invalidateQueries({
predicate: (query) => query.queryKey.includes("user."),
});
12 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/26/2022 in #questions
Are tRPC endpoints awaited internally? Endpoint being called again before it finishes
you could also try turning off batching for that query.
9 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/26/2022 in #questions
Are tRPC endpoints awaited internally? Endpoint being called again before it finishes
if you absolutely have to, a hacky solution is to create a useRef boolean that can be used to conditonally execute the mutation only if it hasnt already been executed.
9 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/26/2022 in #questions
Are tRPC endpoints awaited internally? Endpoint being called again before it finishes
I would advise against doing mutation inside of a useEffect.
9 replies