fix: show loading indicator until all data is fetched#3
fix: show loading indicator until all data is fetched#3dergigi merged 4 commits intojoinmarket-webui:masterfrom theborakompanioni:tbk/devel/fix-loader
Conversation
as two requests are made in CurrentWallet component, a single boolean as loading flag might not represent the current loading state correctly. This commit adds a 'loading counter' that increases/decreases when starting/finishing data requests.
|
I've updated the loading counter to use the component state, so that it works on re-rendering. Can you check if it works as intended? If so, this is good to merge. |
@dennisreimann I am trying to read up on re-rending in react. Thanks for the heads-up. |
|
@theborakompanioni you are correct, I removed my commit. However, then there are these warnings: But when those functions are added as dependencies, it is the same as with my commit. Will need to dig deeper myself :) |
|
Maye |
I am not an expert in react - any help is highly appreciated. Such a simple issue seems perfect to learn best practices from you guys. 💪 |
I'm by all means no React expert. To be honest, I only ever did some smaller side projects but haven't worked on any large React projects professionally. So take everything I say and do with a massive grain of salt. I'm basically learning by doing. 😄 Since the two hooks seem to always be triggered together (same dependencies) I moved both Everyone, let me know what you think, I think it works and I hope it makes sense. 🤞 |
|
Looks good to me 👍 I just tested this and everything works as expected. I'll merge this now and if something is terribly wrong we can address it in another PR. |
as two requests are made in
CurrentWalletcomponent, a single boolean as loading flag might not represent the current loading state correctly. This commit adds a 'loading counter' that increases/decreases when starting/finishing data requests.