Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle layout wrappers based on request headers #1676

Closed
bendik opened this issue Aug 17, 2023 · 2 comments
Closed

Toggle layout wrappers based on request headers #1676

bendik opened this issue Aug 17, 2023 · 2 comments

Comments

@bendik
Copy link

bendik commented Aug 17, 2023

With htmx it'd be nice to be able to toggle recent layout wrapping features based on the header 'hx-request', but these values seem to be statically exported with routeConfig and not when handling the request. Opening issue here to start any discussion on being able to handle this.

Also can mention that I'm not actually using htmx in my project like this just yet, and i suppose i could render separate route with similar render function but different routeConfig.

@bendik bendik changed the title Toggle layout wrappers based on ' Toggle layout wrappers based on request headers Aug 17, 2023
@marvinhagemeister
Copy link
Collaborator

Thanks for opening this issue. This is something @lucacasonato and I were chatting about earlier today. There a couple of stepping stones to make it work. The first step is to get full page navigation working, including island hydration through fetch(). This is needed for #1532 anyway. Once that's done we can explore optimizing that setup by only requesting partial bits.

The thing I'm unclear on whether there is a good heuristic to apply these things out of the box. Layouts could be one, but not sure how it feels in practice. Not everything is a layout too and there may be instances where you want even more granularity in pieces you want to render. I don't know it's early stages and definitely something I want to explore this cycle.

@marvinhagemeister
Copy link
Collaborator

Closing as Fresh 1.5 comes with Partials which allow htmx-style updates to send any layouts to the client. We explored some heuristics to enable/disable layouts, but ultimately always ran into the problem that it's confusing and requires a bit of machinery to make overrides and all that to work. Often there is a scenario, where you only want a particular layout to be applied and that complicates this even further.

Instead with Partials you can just import the Layout component and render that in the partial response. That seems like the best middleground of both worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants