4 ms·
LiveView is a great pattern, but it's worth noting that it is not universally useful or better. If latency of UI change is more important than the latency of da
by lucasyvas 4y ago
LiveView is a great pattern, but it's worth noting that it is not universally useful or better. If latency of UI change is more important than the latency of data update itself, doing the UI update on the client will always make more sense and the data can slide in shortly after.
There is no silver bullet, and sometimes doing a UI update on the client is still a better UX.
I can foresee a future where everyone goes down the LiveView rabbit hole, only to improperly blame it for causing too much UI update latency in some cases.
When it all goes well, it's very clean. If you can't make sure the server is evenly loaded amongst all your clients and close to them, it will probably feel quite poor in comparison to some client side update code.
- brightball 4y agoThat’s definitely true, but in my experience the data update is the 80% use case.
- ch4s3 4y agoI think you’re directionally correct, but LiveView has a JS api that can fire off front end events. You can tie in React, Vue, Alpine, or whatever if you want.
- realusername 4y agoIf the UI change requires no network calls, it's better to use a JS hook or/and Alpine in my opinion.
- yencabulator 4y agoThe parent is talking about a scenario where the network action may take longer, and you want the UI to remain responsive. Consider a save button that goes through state transitions dirty->saving->saved.
- POiNTx 4y agoOn this note I've been developing LiveSvelte these last 2 weeks. It's not finished yet but it's promosing. Takes a way a lot of the UI update issues with LiveView as you can have local state very easily while still maintaining reactivity with LiveView wherever you need it. LiveSvelte: https://github.com/woutdp/live_svelte/ https://github.com/woutdp/live_svelte/
- bongobingo1 4y agoMay be of interest to you: https://www.youtube.com/watch?v=I4vVxtrow-E https://www.youtube.com/watch?v=I4vVxtrow-E
- POiNTx 4y agoThank you, haven't seen this before. Similar to LiveState[0] also [0] https://github.com/launchscout/live_state https://github.com/launchscout/live_state