#Multiple router-outlets - Good or bad idea to introduce?

19 messages Β· Page 1 of 1 (latest)

halcyon sapphire
#

Heyho, I'd be curious on opinions on using multiple router-outlets.

I'm mostly stating this as I worked (as junior to mid-level dev, several years ago) on a project that utilized a secondary router-outlet to control its sidebar in the past.

The experience I made with that were, that it made things a fair bit harder to wrap your head around while at the same time making your URLs ugly/illegible.
For seemingly no benefit, because everything it achieved I seemingly also could do without.

That entire experience gave me the impression that it seems overall not worth it ever to actually use multiple router-outlets despite the option being there.
Am I wrong there?
Are there maybe scenarios/patterns where its not as painful and where such a setup can actually shine?

slate heron
#

I saw an example where a second outlet was used to render components in a modal dialog which seemed quite useful

shut cipher
# halcyon sapphire Heyho, I'd be curious on opinions on using multiple router-outlets. I'm mostly ...

I disagree, multiple outlets are cool πŸ™‚, and useful. But it has been painful setting it up sometimes. And involved some magic, iirc I never managed to create a routerLink that "removed" a certain named outlet. Perhaps better now.
One usecase I like is where you have some info that can be shown in several way, say a statistic that can be in a table or a graph - something like /(view:table) and /(view:graph).
iirc the guy working on the router in the beginning (Victor?) thought everything should be in the router, keep as much state as possible there. My experience is you have to give some thought as to what you want indexed and crawled.

halcyon sapphire
shut cipher
halcyon sapphire
#

Ah right, sorry need to split my brain again because thinking of essentially stuff as 2 independant parts of a page is a bit of a brain breaker for me

#

I think this is still too hard for me to reason about I think.
I can sort of guess with a lot of entirely independent parts of a webpage that it could be useful... but I've not build anything like that yet, at all.
The requirements to arrive at sth like that seem like they would be wild

#

Particularly since you're sacrificing legible URLs

shut cipher
#

But after thinking about it for quite a while I don't think it's that complicated 😏 , the independent parts n stuff. And can be useful to be able to link to exactly what you want. Plus lazy loading

halcyon sapphire
#

For the most part its rough because figuring out how you're routing through one tree already can be difficult, figuring out through two trees and accounting for all the possibilities in how the components might occur on screen is just no longer possible at some point

shut cipher
#
halcyon sapphire
#

Funnily enough, I already make use of anything he mentions in the first half (empty routes, pathprefix strategies because I make sure my empty path are only matched for "full" matches etc.

#

Turns out I've encountered or am already using pretty much everything the guy mentions, I just don't like the secondary router-outlet πŸ˜„

shut cipher
halcyon sapphire
#

I'm not a fan

shut cipher