Sid
Sid
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Sid on 9/12/2024 in #questions
Single react query doesn't seem to hit then endpoint in production (Vercel)
Hi there, Thought i'd ask here as i'm at a loss I have a dashboard page with 2 queries: 1. getRecentContent 2.getDashboardStats When I load the page in production, the Vercel logs show that only getDashboardStats is getting hit, getDashboardStats doesn't, even though its on the same page So I figured it was a FE problem, so I went to log the query stuff, I notice: 1. The query is running 2. It flips from isLoading instantly, suggestive of something being returned very quickly before a network request is being made 3. The other query takes far longer to load in because it is actually hitting the API It executes as expected in development I would have thought there was some weird caching thing, but the two procedures are on the same router, and accessible via the same api route Has anyone faced something similar, or can suggest something to look into?
9 replies
TTCTheo's Typesafe Cult
Created by Sid on 6/12/2024 in #questions
How can we enable experimental TRCP features?
I'm using the app router, and i'm getting type errors when trying to enable experimental TRCP features, specifically, i'm trying to enable streaming responses: https://www-git-05-01-stream-trpc.vercel.app/docs/client/links/httpBatchStreamLink#generators But adding it to the initTRCP function gives me a type error:
const t = initTRPC.context<typeof createTRPCContext>().create({
experimental: {
iterablesAndDeferreds: true,
},
transformer: superjson,
errorFormatter({ shape, error }) {
return {
...shape,
data: {
...shape.data,
zodError:
error.cause instanceof ZodError ? error.cause.flatten() : null,
},
};
},
});
const t = initTRPC.context<typeof createTRPCContext>().create({
experimental: {
iterablesAndDeferreds: true,
},
transformer: superjson,
errorFormatter({ shape, error }) {
return {
...shape,
data: {
...shape.data,
zodError:
error.cause instanceof ZodError ? error.cause.flatten() : null,
},
};
},
});
I've tried updating the TRCP packages, but that seems to not work. Has anyone had any luck with this?
1 replies