balakay
balakay
TtRPC
Created by balakay on 7/9/2024 in #❓-help
UseQuery iterator not working for me
I am on tRPC v11. Using the example provided in the documentation under "streaming responses using async generators" (re: https://trpc.io/docs/client/react/useQuery) I get the following error in the client:
Cannot use stream-like response in non-streaming request - use httpBatchStreamLink
Cannot use stream-like response in non-streaming request - use httpBatchStreamLink
Any idea where I might be going wrong or if there are some configs I need to change? Server
const t = initTRPC.context<ExpressContext>().create({
experimental: {
iterablesAndDeferreds: true,
},
});
//...
test: appProc.query(async function* () {
for (let i = 0; i < 10; i++) {
await sleep(1000);
yield i;
}
}),
const t = initTRPC.context<ExpressContext>().create({
experimental: {
iterablesAndDeferreds: true,
},
});
//...
test: appProc.query(async function* () {
for (let i = 0; i < 10; i++) {
await sleep(1000);
yield i;
}
}),
Client
export const trpc = createTRPCReact<AppRouter>();
//...
const iterable = trpc./*...*/.test.useQuery();
export const trpc = createTRPCReact<AppRouter>();
//...
const iterable = trpc./*...*/.test.useQuery();
3 replies