hotwired-laravel / turbo-laravel

This package gives you a set of conventions to make the most out of Hotwire in Laravel.
https://turbo-laravel.com
MIT License
803 stars 50 forks source link

How to hotwire a UI like admin panel? #101

Closed bilogic closed 1 year ago

bilogic commented 1 year ago

image

Simplified view of a typical admin panel

I have been stuck with this for a while, but the problem has been clearer and easier to define now, let me explain:

When I click on the red side menu, I expect blue and green to change

https://discuss.hotwired.dev/t/turbo-stream-inside-turbo-frame-response-is-this-a-legit-pattern/3812/2 I read that it is possible to embed a turbo stream in a turbo frame but it feels hacky and can be quite a challenge to implement. The only way I thought of now is to make special provisions when returning a turbo-frame, i.e. we can dynamically embed a stream when rendering the full/partial blade HTML, but this could become uncacheable.

Am I just overcomplicating the solution or is there already a simpler and elegant one to the above?

Thank you!

tonysm commented 1 year ago

It's definitely tricky. I covered a similar use case in this blogpost.

The main ideas behind it are:

I'll close the issue for now, but please let me know if that was helpful.