-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Get correct transaction data in ReportActionItem #39940
Conversation
@ishpaul777 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
key: ({parentReportActionForTransactionThread}) => { | ||
const transactionID = (parentReportActionForTransactionThread as OnyxTypes.OriginalMessageIOU)?.originalMessage.IOUTransactionID | ||
? (parentReportActionForTransactionThread as OnyxTypes.OriginalMessageIOU).originalMessage.IOUTransactionID | ||
: 0; |
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.
have you tried this i found that parentReportActionForTransactionThread may or may not have the originalMessage.IOUTransactionID
so thats not reliable working solution
key: ({transactionThreadReport, report}) => {
const allReportActions = ReportActionsUtils.getAllReportActions(report.reportID);
const parentReportActionID = isEmptyObject(transactionThreadReport) ? '0' : transactionThreadReport.parentReportActionID;
const action = allReportActions[parentReportActionID ?? '0'];
const transactionID = (action as OnyxTypes.OriginalMessageIOU)?.originalMessage.IOUTransactionID ? (action as OnyxTypes.OriginalMessageIOU).originalMessage.IOUTransactionID : 0;
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
},
@nkdengineer gentle bump ⬆️ |
Hi @nkdengineer, please take a look at @ishpaul777's comment when you have a moment |
checking this now. |
const moneyRequestAction = allReportActions.find((action) => { | ||
const actionType = (action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? ''; | ||
return actionType === CONST.IOU.REPORT_ACTION_TYPE.CREATE || actionType === CONST.IOU.REPORT_ACTION_TYPE.TRACK || ReportActionsUtils.isSentMoneyReportAction(action); | ||
}); |
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.
@ishpaul777 The reason because the filter here was wrong. Before it was !ReportActionsUtils.isSentMoneyReportAction(action);
. Update this condition correctly, please help to check again.
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.
@ishpaul777 For combine report, the only moneyRequestAction
is the parentAction of transaction thread report. The check return actionType === CONST.IOU.REPORT_ACTION_TYPE.CREATE || actionType === CONST.IOU.REPORT_ACTION_TYPE.TRACK || ReportActionsUtils.isSentMoneyReportAction(action);
is used to find that.
It this the negation of the check that we used to filter out this action type below. We also can use the filter action.reportActionID === transsactionThreadReport.parentReportActionID
here the result is the same.
I don't like the solution to use ReportActionsUtils.getAllReportActions(report.reportID)
because we don't subscribe allReportActions
from Onyx in ReportActionItem
.
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.
The check return actionType === CONST.IOU.REPORT_ACTION_TYPE.CREATE || actionType === CONST.IOU.REPORT_ACTION_TYPE.TRACK || ReportActionsUtils.isSentMoneyReportAction(action); is used to find that.
this doesn't seem true, as you see in video reportActionID is different than passed as prop, also the issue is still reproducible
Screen.Recording.2024-04-10.at.12.40.09.AM-1.mov
we don't subscribe allReportActions from Onyx in ReportActionItem.
this is a valid concern In this case we should subscribe the reportactions in ReportActionItem using the same pattern we follow in https://github.com/Expensify/App/blob/59ebbc8956cb78a22d7b745b9791ee46c7bf2965/src/components/ReportActionItem/MoneyRequestView.tsx
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 523 to 530 in 59ebbc8
withOnyx<MoneyRequestViewProps, MoneyRequestViewTransactionOnyxProps>({ | |
transaction: { | |
key: ({report, parentReportActions}) => { | |
const parentReportAction = parentReportActions?.[report.parentReportActionID ?? '']; | |
const originalMessage = parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? parentReportAction.originalMessage : undefined; | |
const transactionID = originalMessage?.IOUTransactionID ?? 0; | |
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | |
}, |
Here's a Branch for reference code
main...ishpaul777:App:fix/pull/39940
We also can use the filter action.reportActionID === transsactionThreadReport.parentReportActionID
This can also work but i prefer we avoid drilling prop when we can
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 doesn't seem true, as you see in video reportActionID is different than passed as prop, also the issue is still reproducible
@ishpaul777 Can you share the full step for this case? I can't reproduce it in this PR now.
This can also work but i prefer we avoid drilling prop when we can
we already have allReportActions
in ReportActionsView
so I think we should get on this and because we can have many ReportActionItem
, subscribing again allReportActions
in each ReportActionItem
isn't good for perf.
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.
@ishpaul777 Any update here.
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 think the changes here are stale right now becuase issue is no longer reproducable, though the reproduction steps was same as in the PR description
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.
okay i gave this a thought lets move with passing the reportaction filtered with action.reportActionID === transsactionThreadReport.parentReportActionID
as prop but can you please first share a screen recording of the bug that exists now
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.
can you please first share a screen recording of the bug that exists now
As we can see in this condition, we will show the total in combine report if the transactionCurrency
is different from the currency of the workspace.
{transactionCurrency !== report.currency && ( |
But on staging, we can see in both case the total always appears. The problem is what I mentioned in my proposal, transaction
is always undefined
in ReportActionItem
.
cc @pecanoro
okay i gave this a thought lets move with passing the reportaction filtered with action.reportActionID === transsactionThreadReport.parentReportActionID
I updated it.
@ishpaul777 Please help to check again. |
i am still not covinced and neither this works for me even now, i have provided a working solution with minimal changes. I think we both can agree the RC here is reportActions passed as prop does not include
|
I am going to revert the original PR and we can work on this slowly to find the best solution |
I agree, this solution does not seem like something we would like to CP |
I think this PR can be closed now |
@mountiny We still a bug with combined reports and the pending action, the total disappears as soon as the action stops being pending (I think) |
I believe this PR was to solve the view for transaction thread right which is solved with the revert, was there any other issue 🤔 |
@ishpaul777 The other issue is
|
Yeah, I originally posted here to fix both. It is probably due to some optimistic data because after a bit, it gets updated when it gets the info from the back-end. |
Reviewing this, @nkdengineer Can you please merge main |
Reviewer Checklist
Screenshots/VideosAndroid: NativeWhatsApp.Video.2024-04-20.at.3.27.24.AM.mp4Android: mWeb ChromeVIDEO-2024-04-20-03-34-43.mp4iOS: mWeb SafariScreen.Recording.2024-04-20.at.3.22.20.AM.movMacOS: Chrome / SafariScreen.Recording.2024-04-20.at.3.21.23.AM.movMacOS: DesktopScreen.Recording.2024-04-20.at.3.49.19.AM.mov |
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.
LGTM!
@pecanoro Please help to review the PR when you have a chance. |
It seems to be working! Though I tested it during a back-end deploy, so not sure if it affected anything since it made everything slower 😄 |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.64-6 🚀
|
Details
Get correct transaction data in ReportActionItem
Fixed Issues
$ #39824
PROPOSAL: #39824 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-04-09.at.20.41.18.mov
Android: mWeb Chrome
Screen.Recording.2024-04-09.at.20.39.54.mov
iOS: Native
Screen.Recording.2024-04-09.at.20.42.04.mov
iOS: mWeb Safari
Screen.Recording.2024-04-09.at.20.39.01.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-09.at.20.36.51.mov
MacOS: Desktop
Screen.Recording.2024-04-09.at.20.43.10.mov