#Replace Parent Layout
110 messages Β· Page 1 of 1 (latest)
Have you looked into route groups?
yea, but what about my top level layout? I need it too in some routes which are defined on the top level
oh wait..
that's exactly what that link is for π
() does not affect path so they get merged
I see
so there is a issue using rewrites
if I remove the top level layout and put it in a folder called (root)/layout.tsx where basically every route share the same layout
and move my rewrite route to a separate folder like (profile)/profile/[username] its complaining like that my [username] is not a React.component
even when there is a page.tsx which seems working outside the route group
wtf after restarting the next dev it seems to work now
looks like next dev can't really handle folder movement or deletion
ahhh, I have had that fix a few things over the last few days. π
I haven't tried without deleting .next though. I always delete that first. I'll have to try only restarting next time.
hahhaa
so if I understand correctly they also changed the behaviour of error
like before I had a 404.tsx because error.tsx was kinda buggy before (always tried to reload / fetch smth)
I've only been using React/Next.js for a couple of days so not quite sure on the changes.
haha, well you don't have to use them π
I'm starting a new app so it has been pretty painless
but I can see migrating an existing project being a pain
13 happened to come out pretty much the day I started my project
if I had an existing code base that was chonky I wouldn't even try to migrate
now I'm kinda confused. I added the not-found.tsx into my top level and I still get the basic 404 from nextjs
π
have you tried in your route group?
yeah, looks like one in /app should be fine
does whatever you're using call notFound() to make it trigger?
didn't try that way
but what about if the user enters a invalid url?
cuz the error.tsx will not be visible
ignore what I said while I reprocess
yeah, I can't seem to trigger the 404 either, hrmm
These aren't changes to the existing system, it is new features built on top. You do not have to switch to an app directory. You can still use Next 13 with pages.
Super curious why you are switching to the app folder today if you find it to be such hassle.
I have an example here that has 3 different layouts.
- Core one for landing pages, and login
- No layout for sign in
- Custom layout for dashboard.
https://github.com/jensen/supabase-nextjs
Can see the layouts here: https://supabasev2-nextjs.vercel.app/
I am kinda forced to do this migration π
why though
I love these changes ngl but itβs kinda hard to migrate a large existing project
my company wants these changes
idk why
guess they want a new structure
Ok, well that is a shame.
πππ
Stupid move
Hopefully we can help you get it going mostly
and hopefully they dont have unreasonable expectations on what an migration like this looks like
actually you all did
and how long it can take
I got the most things done today
just missing the custom error page & the API requests
api requests will need to stay in pages
or wait responses if you have any
the requests you are right
actually we are not using the api routes from next
π
but I like this new layout thing. especially that my data will be kept in route changes
The only thing I've run into that has been a stopper for me, is the inability to change the response from server components.
I have gotten around a bit of it by using middleware
feel you
For example had to move my cookies setting to middleware
π―π―π―π
actually wasnβt there a forum post which provided a good example to pass the data from a server component to a child
π€
I don't have an issue with that. It is really just response mutation
the most hard thing for me was using like use client in every page
cuz my tailwind components are forcing me to do that
Hehe. Your company asked you to switch to the app folder, maybe for server components, yet your app contains very few server components... big surprise!
Our decisions of the past are going to have a major impact on the ease at which we migrate to more client/server hybrid apps like this
Is it tailwind UI?
yep
I guess itβs not a issue of tailwind but of headless ui
yes
definitely, the react package from UI would depend on headless, and headless would depend on react hooks.
sadly yes
idk if headless is gonna change that in future
but I donβt think so