pillaiindu

pillaiindu

A post from Dev Talk directed me to this todo demo at SvelteKit. I was surprised how slow the response of creating and deleting a todo was, considering the performance of Svelte. Then I opened the network tab and I realized it was sending requests to the server on my slow connection.

I realized it needed Optimistic UI updates / Latency compensation to be instant. Then I remebered that I had asked about the possibility of Optimistic UI in LiveView in Feb 2019.



I asked that question when LiveView was new. Now LiveView has matured and there are a couple of books on LiveView (one from Pragmatic Bookshelf and another one from Groxio), and a detailed video course from Pragmatic Studio.
What is the scenario now? Can LiveView make Optimistic UI updates, or we still need to use GraphQL, Apollo, etc to have Optimistic UI updates?

@chrismccord


Showing Posts 6 to 1

kelvinst

kelvinst

Plus the fact that it requires you to implement a lot of duplicated logic on server and client. With LiveView you can be productive because you are not reimplementing a lot of stuff over and over. With SPAs you implement a lot of validations on the server for data consistency reasons and you implement the same validations on the client to be able to actually be optimistic without giving the user a lot of false positives.

andreaseriksson

andreaseriksson

On the other hand, optimistic ui:s comes with some drawbacks. Just because you add/or delete an element in the interface and it instantly appears/disappears, you cant be 100% sure the server made the change (hence optimistic).
Besides that, you can sprinkle in some js to make the client side snappier when removing resources and other cases like that.

pillaiindu

pillaiindu OP

Thank you for your answer! I loved the anology. :grinning:

But maybe people like @josevalim and @chrismccord are able to create an airplane which can submerge in the ocean, at least in the BEAM world.

al2o3cr

al2o3cr

IMO LiveView makes a totally different set of tradeoffs to run most/all of the logic on the server-side: GraphQL + Apollo is designed to run much of that logic on the client side.

Translating to physical objects, this question is like asking “can Airplane now dive to the bottom of the ocean, or do we still need to use Oxygen Tanks and Submarines?” Both things are designed for their particular use-case, and while similar they aren’t interchangeable.

pillaiindu

pillaiindu OP

I think “phx-disable-with” has a good use case. When you want to prevent user from performing an action which is already performed but the feedback is not yet arrived from the server.
You can use it for enhancing the user experience and preventing user from making a mistake (performing the action twice which s/he intended to perform once), but I don’t think it’s an alternative to a full blown Optimistic UI.

BartOtten

BartOtten

You should be able to use phx-disable-with for optimistic UI on the client. However, that seems to be only applicable to the element you are interacting with. Maybe it’s a start though…Can’t check it myself as I am on mobile.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews