Spaceman
TTCTheo's Typesafe Cult
•Created by Spaceman on 7/28/2023 in #questions
Pattern for Next.js path strings (App Router)
Does anyone have a good strategy for handling the paths to different pages in next? I'm using the app router but I moved some files around which adjusted the url paths for all the pages, and now I'm paranoid that I have dangling hrefs and router.push-es pointing to the old paths.
Makes me think there has to be a better way to manage the strings of where things are routed.
Long ago in my Ruby on Rails days they had amazing path helpers where you would never link or reference any path directly you would call a helper that would generate the path string and that way you never had to worry about linking to old paths.
Anyways, anyone know a good way of handling this in next+app router? Maybe there's something obvious I'm missing.
8 replies
TTCTheo's Typesafe Cult
•Created by Spaceman on 4/15/2023 in #questions
Next 13 App Router Realtime - Am I missing something?
I want to have some kind of real time behavior for my app. I've decided that SWR (https://swr.vercel.app/) is the right way to go for me, just for simplicity sake.
Imagine I use the Next 13 App Router, make database called in my server components, then render the client components with that data. In this case if I wanted to implements SWR then for that data then I would still have to define a tRPC route to fetch that same data in order to wrap it in the SWR component.
So basically that client component would receive the data from its parent server component but then would have to also call the tRPC + SWR for the same data. The same would be true for any real time layer you would implement in the client component.
So basically I'm doubling up my data access for this same component. Maybe I'm just asking too much from Server Components, but I was hoping that they would simplify the api and make a lot of the GETs unnecessary. I guess not if you want to have real time.
Am I missing something here?
2 replies