'useInfiniteQuery' hook disappeared after moving to Turborepo
I am using Turborepo with Next.js with the following layout, originally a T3 app
-
/apps/app
- /packages/api
The useInfiniteQuery
hook seems to have dissapeared after migrating, and I can't get it back.
I am using @trpc/next
on the clientside, @trpc/react-query
is installed, and everything seems fine?
I'd love some guidance, I'm a little stuck...
/apps/app/src/utils/api.ts
/packages/api/src/routers/job.ts
`/packages/api/src/root.ts
26 Replies

Interesting - it might be something to do with the
tsconfig
I added strict: true
through in the child tsconfigs
even though it's enabled at a top level.
And the job.
disappeared from the router...
Still investigating
Okay, so turns out in my hate of setting up turborepo, strict mode wasn't enforced, that's enabled now. But what's odd, is the api.job
is now never
type 0_o
And now finally at what appears to the be root of the issue
Throws:
This tracks. The cursor needs to be there and if the parent object is nullable it doesn’t get detected. Strict null checks needs to be on at minimum and a new repo might not have that
Yeah strict mode enabled through and through now.
Was a red herring.
Now having issues with the appRouter...
An you share your backend setup?
It's a next app, the appRouter and server are in their own package in a turborepo'd monorepo
tRPC runs on the next app, not on an independent service



Right so the error actually starts in your AppRouter I think
Ignore the frontend errors until that’s fixed
100%
What does the AppRouter look like? Might need to see quite a bit of the setup. Try commenting up sub routes until the error goes away
That's the app router.
Let me comment out the sub routes and see what happens.
So I've just changed it to this, removing my procedures and sub-routes.
Same errors.
I'm happy to share the repo
Can you show trpc.ts?
Might be to do with t setup
Is pretty out of the box
I think I've only added the admin middleware
Oh discord doesn’t like text files on mobile 🫠
Best to paste a code block
Sec
I'll remove comments
It’s definitely a weird one
I don’t see anything obviously wrong but it’s hard to tell on mobile
It's super weird... Is it a typescript or linting issue? As that's all I've been playing around with
The images you shared with the errors are probably quite useful
Do both projects have strict enabled?
Everything has strict enabled
Cool
I’ll need to have another look a bit later when I’m on desktop
I'll go through and even do it on a package level tsconfig, not just the base
Thank you! Much appreciated!
If you want the source code, I'm happy to share the repo with you
Definitely make sure it’s not being switched off in any way. Base should be fine though
The repo would probably help. If you have time try and put together a minimal reproduction
You saw my antics before of chasing down tsconfig issues, so it could be, but I'm doubtful
I'm based in AUS so it'll likely be tomorrow.
I can share you the repo that it is now, if you shoot through your GH
It's fairly minimal anyways, if I take it back any further I'll be stripping out the monorepo
Hol' up - might have some version mismatching going on
Wow, okay... so two packages had different version of
@trpc/next
and @trpc/server
Must've happened when splitting out, I've done some more consolidating, brining the next client into the api package, wowweee
Edit: And strict mode, obviously... shit breaks without it (but we know this, this is just for the others experiencing weirdness, if it's weird it's usually versions or strict mode)Brilliant, that was one thing I was going to check 😃
Appreciate it @nlucas !