Xiphe / remix-island

utils to render remix into a dom-node instead of the whole document
MIT License
131 stars 7 forks source link

Ignore the Layout export for Head if possible #15

Closed silvenon closed 1 month ago

silvenon commented 1 month ago

I love this module, it unlocked my progress, thanks a lot for creating it!

Considering that the Layout Export is now a thing, it took me a long time to figure out why a bunch of my scripts and scroll restoration logic kept ending up in the <head>. Once I got acquainted with the hack I figured out that it was because my Layout contains them, so Head inherits them as well.

The problem with this trap is that it can take a while to figure out that something bad happened at all, so my question is — is there a way to modify the hack to ignore the Layout export just for Head? Ideally I'd like to keep using Layout as if the hack isn't there 🙁

silvenon commented 1 month ago

The solution is as simple as modifying Remix context to exclude the Layout export. I'll send a PR.

adamduren commented 1 month ago

@silvenon I really appreciate your work on this library and it has saved us. Regarding the Layout Export on the documentation it talks about addressing FUOC by use of the component. Is this library still needed now that this is a feature?

silvenon commented 1 month ago

Yes, this library is needed if you want what it's offering.

What I did was just a bug fix, precisely so that we could continue using remix-island with the Layout export, the two are otherwise unrelated.