DEV Community

Discussion on: How to Display the Progress of Promises in JavaScript

Collapse
jbartusiak profile image
Jakub Bartusiak • Edited on

I can't see an actual use case where this would be that useful. If you're waiting thirty seconds for something to complete and block the user, you're doing something wrong. Either way, this should be implemented on the backend with a progress endpoint or sth.

Collapse
jrdev_ profile image
Jr. Dev 👨🏾‍💻 Author

Hey, thanks for your comment.

A use case I used the other week was deleting multiple rows/data from a grid.

Another common example is app initialisation, how often do you open an app and there is a loading widget for a few seconds before you can use it?

Collapse
jbartusiak profile image
Jakub Bartusiak

I see what you mean, yet consider this.
When you'd delete data from the grid, I'm guessing that happens on the backend, right? Then, a better approach would be to remove the deleted items from the grid locally and notify the user whether the operation was successful or not.
For the second example, consider lazy loading some modules, or using placeholders for components being loaded (like skeletons).

Thread Thread
jrdev_ profile image
Jr. Dev 👨🏾‍💻 Author

I wouldn't say a better approach, but definitely a viable one dependent on the requirements 👍 Thanks for adding your comment though, definitely an alternative approach to consider