Hacker News new | past | comments | ask | show | jobs | submit login

I assume you have to specifically design your site to work with both the request/response model and the LiveView model in order for this to actually work, as opposed to LiveView being able to plug that hole automatically for you.



To be a little more concrete, here's an example:

  <%= live_patch "about", to: Routes.about_path(@socket, :index) %>
which creates:

  <a href="/about" data-phx-link="patch" data-phx-link-state="push">about</a>
The data attributes are read by the LiveView HTML and are otherwise ignored by a JSless broswer.

Edited to fix glaring code sample error.


You can design singularly for LiveView and it handles everything. But if you want both request/response and LiveView (e.g. to mix the two or fallback to r/r when no js) you have to be more explicit in your design. It’s mostly trivial though. I have authentication pages that use the old controllers but pages that use only LiveView without any hassle.


Nope, all you need to do is make sure that everything has a route (which is very much encouraged in LiveView) and it works.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: