-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: show loading indicator until all data is fetched #3
fix: show loading indicator until all data is fetched #3
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me ✅
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
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.