3 ms·
It can be pretty bad especially for UI updates that you are used to being handled client side. Example: You click on an upvote button and it changes color, but
by gangstead 3y ago
It can be pretty bad especially for UI updates that you are used to being handled client side.
Example: You click on an upvote button and it changes color, but there's 1 second of latency.
SPA: Color updates immediately, the "upvote pressed" http/websocket call to the server arrives one second later.
LiveView: liveview.js sends "upvote pressed" over the web socket, one second later the liveview process on the server gets the message, patches the dom and replies, one more second later the button changes color. Meanwhile the user has pressed the button 2 more times wondering why the color isn't updating.
There are phx-hooks (https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks-via-phx-hook https://hexdocs.pm/phoenix_live_view/js-interop.html#client-...) to address this with small targeted bits of js where you can add event listeners but it can get messy quickly.