-
Notifications
You must be signed in to change notification settings - Fork 14
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: payment builder table loading state #2451
base: master
Are you sure you want to change the base?
fix: payment builder table loading state #2451
Conversation
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.
Hey @joanna-pagepro, thanks for looking into this!
The default address no longer shows up, but the loading state looks to be a bit inconsistent from what I have experienced.
![image](https://private-user-images.githubusercontent.com/165801260/334418990-3f9f47ee-5271-4dd2-aae5-da1e24beab4a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3MTQ5MzEsIm5iZiI6MTcxODcxNDYzMSwicGF0aCI6Ii8xNjU4MDEyNjAvMzM0NDE4OTkwLTNmOWY0N2VlLTUyNzEtNGRkMi1hYWU1LWRhMWUyNGJlYWI0YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxOFQxMjQzNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zYTcxYjE1N2ZjYzE3NzVlMzFkN2ZkZmIxMGIwYzQwZDZmMTE0NjgxMDc1ODA5MTRmODhlZTQ1MGNkZGI3ZjQ3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.F0QmW8bVXuyh5CiRjwWDJgf-iHs22bFuGM4YVxGtcCs)
Here's the expected behaviour for the loading state:
- You should see the skeleton loader with 3 rows until all the table data has loaded.
Actual current behaviour:
- Data seems to be displayed as it is loading
- Skeleton loading appears only for the exact data that has yet to be loaded
- If there's a row with data yet to load, all the other rows with complete data will still be visible
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.
Nice one! Code-wide all good apart from one minor comment.
The skeleton loading state also looks good to me, but we might need to check with @JoinColony/product about Marco's comments on the exact requirements here.
'text-warning-400': !recipientMember?.isVerified, | ||
'text-gray-900': recipientMember?.isVerified, | ||
})} | ||
isLoading={loading || isLoading} |
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.
A bit of a nitpick, but could we change the namings of these two variables to be more specific? Imo, loading
and isLoading
work fine as variable names if there's only one present, with them both it's a little confusing.
Perhaps something like loadingRecipientField
and loadingMemberContext
, just as an example. What do you think?
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.
Code-wise looks good (other than what Dave mentioned).
I'm also seeing the data appear incrementally and skeleton only showing on the user popover which is expected as the on-chain events are processed sequentially.
To show skeleton loader until all data is loaded you could store the expected count of payouts when expenditure is created and display the loader until the expenditure
object from API has matching count of slots. You would need to check all of those slots have recipients set, and payouts with expected amount and claim delay. Feel free to ping me if you require more details.
377a3fc
to
726eca9
Compare
@jakubcolony The problem was that data related to the recipient was fetched inside the |
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.
Overall the changes are quite nice, we are slowly consolidating these popover components!
I dropped one comment, I think that we can stop passing isLoading
to UserPopover
and UserInfoPopover
, since you made it that UserInfoPopover
fetches data both from the member context and graphql
@@ -50,14 +51,18 @@ const useGetPaymentBuilderColumns = ({ | |||
[blockTime, finalizedTimestamp, slots], | |||
); | |||
|
|||
const { loading: isColonyContributorDataLoading } = useMemberContext(); |
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 actually think the solution you've implemented in UserInfoPopover
fetches data from the same source, so we don't need to pass isLoading
to UserPopover
.
Maybe we could try removing that property. We can also try and see what happens if we revert the loading flag changes here (maybe it won't work though)
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.
@bassgeta it's used to pass the loading state of the data from the table, so I think this prop is also needed so that skeleton loader will be shown for all of the table items simultaneously. I also want to show the loading state on other items from the table when user data is being fetched.
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.
@jakubcolony The problem was that data related to the recipient was fetched inside the UserInfoPopover component, separately from the expenditure data. I used member context to get rid of this effect. Let me know if my solution is ok, or if I should revert the changes. I couldn't see any other issues, so if you see anything else, please also let me know.
I think that's fine, but please take a look at Kerry's comment as you might not need to pass the additional isLoading
prop.
Nice work on this 👍
Screen.Recording.2024-06-10.at.19.50.28.mov
@davecreaser @bassgeta can you review this one again? |
726eca9
to
06fdfcc
Compare
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.
All good to me except one small thing!
@@ -154,7 +159,7 @@ const useGetPaymentBuilderColumns = ({ | |||
fetchCurrentBlockTime, | |||
finalizedTimestamp, | |||
hasMoreThanOneToken, | |||
isLoading, |
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.
On line 65 (inside the useMemo) you still have isLoading={isLoading}
which means there's now a missing dependency in the dependency array of this useMemo call.
You'll need to either keep isLoading as a dependency or change that line to isLoading={isDataLoading}
to fix it. I assume it's just a missed thing and the second option is what you intended!
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.
This looks great @joanna-pagepro, thanks for your work on making this fix. 💯
Description
Payment builder table loading state
Testing
Diffs
New stuff ✨
Changes 🏗
RecipientField
andUserPopover
componentsDeletions ⚰️
TODO
Resolves #2414