We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
When developing applications, it's common to encounter scenarios where a user's request takes longer than expected. This delay can result from various factors like data transformation, external API calls, or slow database queries.
Fortunately, when constructing a Phoenix app that leverages the capabilities of LiveView, enhancing the user experience by incorporating spinners for such extended requests is a breeze.
The behavior I aim to illustrate is as follows:
- The user encounters the "Load Data" button on the interface.
- Upon clicking, we simulate an extended request by introducing a
:timer.sleep(2000)
.- While the request loads the necessary data, a spinner becomes visible.
It might seem trivial, but from a user perspective, this serves as valuable feedback, helping them understand that the request might take a couple of seconds to complete.
continue reading on dev.to
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.