-
Notifications
You must be signed in to change notification settings - Fork 54
Add a loading indicator to Profile when loading data #1753
Conversation
|
Hey @ramirotw , cool changes. |
@elena-zh is it possible that the video link you referred to wasn't pasted? |
@ramirotw , yes, it appeared to be so. Sorry about that :( |
|
||
const emptyState: FetchProfileState = { | ||
profileData: null, | ||
//error: '', |
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.
Dead code?
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.
I left that commented to hint Henry to put there the error in #1745
src/custom/hooks/useFetchProfile.ts
Outdated
setProfile({ ...emptyState, isLoading: true }) | ||
const profileData = await getProfileData(chainId, account) | ||
setProfileData(profileData) | ||
setProfile({ ...emptyState, isLoading: false, profileData }) |
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.
Any reason to reset the state on every load?
I would prefer to have the old value visible while it's loading
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.
Yes, good point, it even added an annoying flash between the dash and the value while loading
Since we are deploying today, and this one has unaddressed issues, I will leave this one out. We will be able to repoint this PR to develop branch later, please don't merge to the release/1.4.0 after we close the version |
fdd5a6a
to
c003bec
Compare
Please re-test, this issue should be fixed. Later on if I find a suitable solution to delay the shimmer effect at the end I'll include it. |
The build is failing due to an unrelated change:
|
Same thing that happened to @henrypalacios 's PR yesterday. Couldn't find what was causing it but I assume it was a cache issue with the stored dependencies. Will see if I can find out more about it. |
In the case of this branch, it does indeed have the "broken" code
And it is present on But it's not on Probably a bad merge. I'll send a PR to |
…s/cowswap into ramirotw/issue-1632-profile-loader
Hey @ramirotw , I do not see a loading effect each 5 minutes when a profile data is updated...
|
That's weird, I'm testing on https://pr1753--gpswapui.review.gnosisdev.com/#/profile and locally and I can see the shimmer effect, since the API responds quickly it doesn't take that long before the effect ends though.
I have added an error catch to turn off the loader |
Thanks, @ramirotw , I have simulated a slow 3g connection and was able to see the loading effect on accounts changing/data updating. |
* add shimmer effect when loading profile data * add a 5 minutes interval to profile fetch * do not reset previous profileData * Fix code style issues with Prettier * add loader to profile trades/referrals values * cancel loading when fetch fails Co-authored-by: Lint Action <[email protected]>
* add shimmer effect when loading profile data * add a 5 minutes interval to profile fetch * do not reset previous profileData * Fix code style issues with Prettier * add loader to profile trades/referrals values * cancel loading when fetch fails Co-authored-by: Lint Action <[email protected]>
Summary
Closes #1632
This adds a loading indicator to Profile page labels using the shimmer effect. It also sets an interval to fetch profile data each 5 minutes.
To Test