T
TanStack7d ago
conscious-sapphire

Outlets remounting full url

This may be a question for the router channel but I am using Start so just putting it here. I have a route /writing that has a list stacked sidebar layout. My understanding of outlets is that they are supposed to keep layouts the same for all child routes. so /writings layout when using an Outlet, would not remount when I go to /writing/$slug. However, it is remounting each time I go to a child route. Is that expected? Happy to throw some code here. Didn't know if there was a quick answer
6 Replies
extended-salmon
extended-salmon6d ago
not expected. please provide a complete repro. preferable in router only setup
conscious-sapphire
conscious-sapphireOP6d ago
What do you mean by "preferable in router only setup"? I fairly certain if I made it a router only setup the outlet issues would be resolved. I have gone between convex auth, clerk, better auth (thinking it was auth related). I'll try to move it to router just to test it there.
extended-salmon
extended-salmon6d ago
it sounds like this does not involve start specifics
conscious-sapphire
conscious-sapphireOP5d ago
Ahh, ok. Well I’ll try to repro in router. It’ll be a little bit before I can @Manuel Schiller I replicated it in router. However, for kicks and giggles I removed all data fetching and added hardcoded stuff. The layouts work as expected with the hard coded data. So this seems to be probably an issue with my own understanding of data fetching in router. I am using clerk for auth and convex for db. When navigating, anywhere that has a hook, like useUser or fetches with a convex query, will reload that component. My understanding was that once a component was mounted, when navigating and using outlets, the outlet would not rerender any components on the page regardless of what they do. I'll push up a repo later. Not sure to what extent you want to go with convex and reproducing the issue with data there. Since this is testing I am also happy to make the repo private and invite you so its more easily reproducible with the full setup. I can dm env variables if wanted. I can also make a quick video to show both cases.
conscious-sapphire
conscious-sapphireOP5d ago
ok, @Manuel Schiller here is the repo - https://github.com/Benanna2019/ts-router-issue-repro The main branch is the hardcoded data branch that works as expected. No flickering of ui issues and no flashing of different ui based on layout segments. The branch broken-navigation-with-data is the one that contains data. You will need a convex setup and clerk. I am happy to dm with the current env variables so it is a quick reproduction.
GitHub
GitHub - Benanna2019/ts-router-issue-repro: repro of issue with lay...
repro of issue with layouts when there is data. Contribute to Benanna2019/ts-router-issue-repro development by creating an account on GitHub.
extended-salmon
extended-salmon5d ago
sent you a DM

Did you find this page helpful?