Proposal: Refrain from using "DeadView", endorse an alternative

My thought process is as follows:

  • Do I care if my users have JS disabled? If so, LiveView is out, but I’m probably just making a fun 90s era static page, so whatever.
  • Does this page need to manipulate the (http) session? If so, LiveView is out (although apparently there is work being done to work around this! It’s been linked on this forum but I’m having trouble finding the link)
  • Does this page need make requests that can change its state? Is so, then LiveView is in! At this point the only reason it would be out are because of reasons that would have made me not choose LiveView as a viable solution in the first place, eg, client-side JS is key, I have users all over the globe but can’t afford to distribute my app (although… if you have global users and can’t afford that you have bigger problems)
  • Is the page completely static? If so, LiveView is probably still in! Why? Because as @derek-zhou mentioned, consistency is king. Also, are open WS connections really that wasteful? Technically sure, a bit, but that’s so micro-optimization-y. No React developer has ever considered that they’re forcing some poor schmuck to use up their battery downloading MBs of JS just to click “back” immediately. Is it really that bad if someone has a WS connection open for the 11 seconds they are skimming your About page? But also, this proposal is gaining some traction!

I could also go on about the odd hangs up people have around sending “too much data” over websockets.

Buuuuut, I would love if the controller+view/LiveView could be unified. I’ve thought about this a lot but it’s not such a straightforward problem to solve (or perhaps I just have a skill issue :smiley:). In LiveView we eschew the action attribute for a phx-submit. This, of course, won’t work with the plain old web. Contrast this to Rails’ Hotwire that has an actually PWA story—you can just make a straight up 90s style web app and then enhance it with Hotwire. This is great! …except that essentially all modern apps don’t cater to people with JS disabled and Hotwire’s programming model isn’t nearly as simple as LiveView’s.

Oh! Perhaps you could let me know if I should be using pip or pip3 or anaconda or conda or virtualenv or pyenv or mycobracondaenvpy2.3 what? :upside_down_face: :wink: :crossed_fingers:

3 Likes