I tried a quick search and couldn’t find a discussion, so I thought I’d start my own.
Have you considered wrapping layouts at the Router level instead of inside each component? I think that would be more Rails-like and would feel less like boilerplate as a convention over configuration pattern.
Hey @toobulkeh. Thanks for bringing this up! As far as the router goes, there’s a lot of important design decisions that have to be made, and this is definitely one of them.
I wasn’t a part of the discussion when it happened, but I think this has been discussed, especially since too many things are re-rendering on navigation and putting layouts at the router level might mitigate some of that:
When I last talked to @mojombo (paraphrasing here/hope I’m getting this right), one of the reasons to push-back a bit against having layouts at the router level was just that: that they’re at the router level and we’re not sure if binding layouts to URLs makes sense/is a good decision, though you’re totally right about eliminating boilerplate.
For the second example code block, having routes flat instead of nested is one of Redwood’s design decisions (that I think comes from Rails?) that we super like and hope we don’t have to part with. We just think routes are easier to track down/reason about this way. But nesting routes solve problems that flat routes don’t. So we have to figure those problems out too.
This is all to say that we have a lot of shaping to do, so thanks for kicking this off, and if you (or anyone!) have strong, well-thought-out opinions, we want to hear them!