ElixirConf 2023 - Chris Gregori - Handling async tasks in LiveView with style and grace
ฝัง
- เผยแพร่เมื่อ 27 ธ.ค. 2024
- Comments at: elixirforum.co...
2023.elixircon...
Your UX is broken, and you probably don’t know it. LiveView lets you easily offload work in async processes to fetch information, talk to an external service, or perform some work for the user. But what happens when things go wrong?
Many times, developers reach for Task.async and only pay attention to the happy path. Let it crash, right?! Wrong. Unfortunately, what this really means for LiveView is to let it crash the UI. Even when you plan on failures and handle process isolation, you end up with logic spread throughout your LiveViews and templates. We can do better.
In my talk, I plan to dive deeply into how developers should approach asynchronous tasks in LiveView, focusing on loading states, responses, CSS animations and demonstrating the critical role of databases or ETS for persistence.
Asynchronous tasks in LiveView can be victim to timeouts, unexpected events in the client, or even user navigation which can cause development challenges and user headaches when poorly implemented.
This talk demonstrates how to safely and gracefully handle these unexpected hurdles by walking through tried and tested code used in production systems built entirely in LiveView and Elixir. We’ll see best practice techniques and demos for making asynchronous calls, demoing how to gracefully handle these potential errors, and walk attendees through patterns to promote system resilience and delightful user experiences.
Your UX is just as important as your Elixir code. Following the nitty-gritty details of async operations, we’ll also learn how to trigger CSS animations from the server to keep users informed about progress. Developers can greatly enhance interactivity and user engagement by employing these animations as a feedback mechanism.
Attendees will walk away with valuable insights and clear, actionable knowledge from peering inside production systems that have solved these problems. By the session’s conclusion, attendees will be equipped with the necessary tools and confidence to effectively navigate async jobs in Elixir & LiveView.