T
TanStack2mo ago
stormy-gold

Large monorepo/Next.js refactor to TSR questions/issues

Hi, I have been attempting to refactor our fairly large Next.js codebase to TSR, as I think it solves a lot of the issues and needs we have, and want to test if that is the reality as well. I have already written codemods that update: - Link and useRouter usages (+ syntax) - File route structure - Adds createFileRoute to each route file + removes default export and sets it as component + some other stuff But I am now trying to get a minimal version working so I can work back from there. However I am running into some questions and issues that I can't really figure out. 1. Is it normal for Vite/TSR to have a very long initial load time for the dev server? It retrieves about 1200 files on the first load. Subsequent isn't so bad because then they are cached. 2. I am using trpc, and any time I comment a trpc query back in, the page just loads forever. No errors in the console, terminal or network tab or anything.
15 Replies
stormy-gold
stormy-goldOP2mo ago
As for point 2. It seems that the component triggering the query (using useSuspenseQuery) ends up in an infinite loop.
rising-crimson
rising-crimson2mo ago
It retrieves about 1200 files on the first load.
what is "it" ? the browser?
stormy-gold
stormy-goldOP2mo ago
Yes, correct. My had, should have specified The infinite loop looks to be related to whenever I use a useSuspenseQuery(trpc..). With useQuery this does not happen. Though it doesn't actually fetch either While this is still happening, it doesn't actually seem to be very slow now. Slowly but surely making progress. Though now running into an issue where setting ssr: false on a page makes it so it just returns the RootComponent, nothing else. I tried adding shellComponent as suggested in other threads, but nothing. Any idea?
rising-crimson
rising-crimson2mo ago
how does your root route looke like?
stormy-gold
stormy-goldOP2mo ago
I managed to make the page work with ssr, so not really an issue anymore. But looks like this right now: Currently trying to get CSS & CSS modules working. Seems classes are generated, but none of the CSS is actually included on the browser side
rising-crimson
rising-crimson2mo ago
are the css files not linked in head?
stormy-gold
stormy-goldOP2mo ago
Do you need to do so even for css modules? I do it for the Mantine ones. ill turn it into a gist, only just now realized it got added as a txt
rising-crimson
rising-crimson2mo ago
a full example project would be helpful if you want me to debug anything.
rising-crimson
rising-crimson2mo ago
GitHub
Flash of unstyled content with Mantine & mismatched initial UI · I...
Which project does this relate to? Start Describe the bug I am working on a project using the Mantine component library and am trying out Start. I have set up the basic Start configuration and a ba...
rising-crimson
rising-crimson2mo ago
stormy-gold
stormy-goldOP2mo ago
Oh my god, thanks! Let me try that in our codebase. I could have sworn I tried the mantineHtmlProps at some point, is that really the only difference I am missing?
rising-crimson
rising-crimson2mo ago
and ColorSchemeScript we should contribute these instructions to the mantine docs if it works
stormy-gold
stormy-goldOP2mo ago
I do have colorschemescript in our codebase, so must’ve just hallucinated. Yeah i will contribute it once I confirm this I dont understand what changed that CSS modules works in your sandbox compared to before?
rising-crimson
rising-crimson2mo ago
I just added color scheme script and mantinehtmlprops

Did you find this page helpful?