Phoenix LiveView vs SPA

Just read ALL comments on this thread, I was “yes” “yes” multiple times. It’s quite many good points if I have to quote. I had done a project using phoenix channel with SPA 3 years ago. Currently I am on a project that produces worst case of leex diff, client patch (via live_patch) tooks 7 seconds! And then I switched view layer to Elm and just push pure data (push_event/3) down, and it now takes ~ 1 second! (Bonus: 7MB memory for components diff tracking is now 0.9MB)

Compared to low level phoenix channel + SPA, liveview + SPA is a lot easier. (Server + Client) side routing for free!, push_event/this.handleEvent for free..

So I agree with many points in this thread, liveview without presentation/view layer is still super solid (again, push_event, this.handleEvent, routing (live_patch, handle_param etc). I kinda think all those phx- stuff should be js API. Keep those form stuff since it goes to server anyway. Finally yeah, there’s still room for liveview + SPA indeed, basically liveview + virualdom lib + vanillajs lib + custom element should work well together. Not re-inventing lots of thing on their own virtual[king]dom; the web platform today has many borders (no micro frontend thanks!)

3 Likes