Repository navigation
Migrate payouts - #2384
Migrate payouts#2384
Conversation
yashranaway
left a comment
There was a problem hiding this comment.
hey @EmCousin, Updated the PR to now use router.reload with InertiaRails.merge , updated tests, All pass! Could you please review again?
| props: { | ||
| payout_presenter: payout_props.except(:past_payout_period_data, :pagination), | ||
| past_payout_period_data: InertiaRails.merge { payout_props[:past_payout_period_data] }, | ||
| pagination: payout_props[:pagination] | ||
| } |
There was a problem hiding this comment.
Uses InertiaRails.merge to append new page data to existing list on frontend
| const loadNextPage = () => { | ||
| router.reload({ | ||
| data: { page: pagination.page + 1 }, | ||
| only: ["past_payout_period_data", "pagination"], | ||
| }); | ||
| }; |
There was a problem hiding this comment.
Partial reload to trigger server-side merging of past_payout_period_data
| expect(response).to be_successful | ||
| expect(inertia.props[:past_payout_period_data]).to be_an(Array) | ||
| expect(inertia.props[:past_payout_period_data].length).to eq(payments_per_page) | ||
| end |
There was a problem hiding this comment.
Verifies that InertiaRails.merge correctly handles the data for infinite scroll
EmCousin
left a comment
There was a problem hiding this comment.
It's close to merging, so not closing - can you address the comment below? 👇
|
@EmCousin _a Updated, Separated payout and pagination concerns and also updated the spec. |
|
@yashranaway can you fix the failing tests? |
|
@EmCousin Done, Could you trigger CI ? thanks :) |
|
@EmCousin I’m blocked on getting the test suite to run locally despite multiple attempts. Since the core changes are already approved by you, would you be able to take over and help? If that’s easier, I’m fine closing the PR and letting someone else attempt. only with #2395 🙏 , managed for #2384 sorry for the confustion |
|
Update : The failing tests are not related, added a commit to fix the Lints. Good to merge this PR! |
|
Thanks @yashranaway, I'll take a look next week as I'm AFK until Dec 29 🙏 |
|
Sorry about the hassle and thanks to you, happy holidays @EmCousin ❤️ |
|
@EmCousin can you please trigger CI again |
|
@EmCousin All tests passing, the 2 fails are unrelated! |
EmCousin
left a comment
There was a problem hiding this comment.
Didn't see it in my last review; I'll help you implement those changes
There was a problem hiding this comment.
pagination state should now derive from the props directly
There was a problem hiding this comment.
No, the whole point of letting Inertia handling the props merging is to no longer to have this code at all.
A simple router.reload({ data: { page: pagination.next } }) should be doing the job here
router.reload({
data: { page: pagination.next },
only: ["pagination", "payouts"],
onStart: () => setIsLoading(true),
onFinish: () => setIsLoading(false),
})| pagination: | ||
| } | ||
| props: { | ||
| payout_presenter: payout_presenter.payout_props, |
There was a problem hiding this comment.
We should expose the payout props directly and not create extra nesting here.
| @@ -19,26 +19,15 @@ def index | |||
| next_payout_period_data: seller_stats[:next_payout_period_data], | |||
There was a problem hiding this comment.
next_payout_period_data should be fetched only when necessary. Right now it is always evaluated when hitting this endpoint. That means when performing a partial reload to retrieve the next page of past payouts, this code is executed although it is not used in the frontend. It needs to be moved to a separate method and invoked from within a lambda to benefit from lazy data evaluation
| @@ -19,26 +19,15 @@ def index | |||
| next_payout_period_data: seller_stats[:next_payout_period_data], | |||
| processing_payout_periods_data: seller_stats[:processing_payout_periods_data], | |||
There was a problem hiding this comment.
Same comment for processing_payout_periods_data
| processing_payout_periods_data: seller_stats[:processing_payout_periods_data], | ||
| seller: current_seller, | ||
| pagination:, | ||
| past_payouts: |
There was a problem hiding this comment.
Same comment for past_payouts
Should I start addressing those changes? |
|
@yashranaway yes |
|
@EmCousin Addressed all the changes, Can you review? |
|
@EmCousin autofix 😅 |
|
@EmCousin All tests pass! The failing test seems unrelated. |
|
Same test failed, should I try fixing it? |
Part of https://github.com/antiwork/gumroad/issues/856
Previous PR: #2383
This PR migrates the following page to Inertia:
/payoutsBefore
After
(No visual changes)
Screen.Recording.2025-12-17.at.2.33.44.PM.mov
Without Data
Tests
AI disclosure
Used Claude Sonnet 4.5 for implementation and tests
All code manually reviewed by me
Confirmation
I have watched all Antiwork Livestreams