4 ms·
sounds more like 20/20 solution ux-wise better immediately hide user1 and show a loading button and use rxjs's switchmap
by kitkat_new 2y ago
sounds more like 20/20 solution ux-wise
better immediately hide user1 and show a loading button and use rxjs's switchmap
- hu3 2y agoHow would rxjs's switchmap prevent the user from clicking user2 button? Also your proposed solution involves a lot more moving pieces. Sounds like a 20/80 solution.
- kitkat_new 2y agoyou mean user1 button? It would throw away the previous http request and users 1 data wouldn't even show up Hiding the elements/div would prevent the user from clicking that button. I don't see how it is 20/80. Switchmap is just a different way of doing things, and hiding the deiv instead of blocking doesn't add really add more effort as well. So I don't see how it's a lot of effort while also missing a lot of the desired features?
- hu3 2y ago> Hiding the elements/div would prevent the user from clicking that button. If you're going to start adding logic to hide other elements conditionaly it's prone to become spaguetti. And how would that scale code-wise? Might as well dim the screen and show a loading spinner to convey to the user that they should wait, a fraction of a second on average. Remember this is in the context of a LOB app. Not facbook. Just show a loading spinner from an axios callback and be done with it. It's so fast anyway.
- sabbaticaldev 2y agowhy axios? JS has native fetch everywhere for ages. let’s remove the moving pieces.
- hu3 2y agoAgreed. I'm starting to replace axios with a simple fetch block that emits start/stop/error events. Other libs listen to these events to, for example, show loading spinner on request.
- kitkat_new 2y ago> If you're going to start adding logic to hide other elements conditionaly it's prone to become spaguetti. And how would that scale code-wise? this is a trivial task, it's only going to spaghetti if you go out of your way to make that happen