Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joanna-pagepro
Copy link
Contributor

Description

Payment builder table loading state

Testing

  • Step 1. Create a Payment builder action.
  • Step 2. Add a few rows to the payment.
  • Step 3. Create the payment, keeping an eye on the payment builder table.

Diffs

New stuff

Changes 🏗

  • loading state passed to RecipientField and UserPopover components

Deletions ⚰️

TODO

Resolves #2414

@joanna-pagepro joanna-pagepro self-assigned this May 28, 2024
@joanna-pagepro joanna-pagepro requested review from a team as code owners May 28, 2024 11:54
Copy link

@marcocolony marcocolony left a 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

Export-1716900885744

Export-1716900885744

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

Copy link
Contributor

@davecreaser davecreaser left a 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}
Copy link
Contributor

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?

Copy link
Collaborator

@jakubcolony jakubcolony left a 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.

@joanna-pagepro joanna-pagepro force-pushed the fix/15917761-payment-builder-loading-table-data branch 2 times, most recently from 377a3fc to 726eca9 Compare June 6, 2024 10:05
@joanna-pagepro
Copy link
Contributor Author

@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.

Copy link
Contributor

@bassgeta bassgeta left a 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();
Copy link
Contributor

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)

Copy link
Contributor Author

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.

jakubcolony
jakubcolony previously approved these changes Jun 10, 2024
Copy link
Collaborator

@jakubcolony jakubcolony left a 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

@joanna-pagepro
Copy link
Contributor Author

@davecreaser @bassgeta can you review this one again?

Copy link
Contributor

@davecreaser davecreaser left a 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,
Copy link
Contributor

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!

Copy link

@melyndav melyndav left a 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. 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Payment builder table loading state
6 participants