You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PAID] [$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter #38355
This is coming from #27262. You can read the issue description there to get context behind the problem being solved and the mess being cleaned up.
Problem
ReportUtils.getIOUReportActionDisplayMessage() is called from a view component. It contains logic which calls const transaction = TransactionUtils.getTransaction(originalMessage.IOUTransactionID ?? ''); (a deprecated method).
Why this is important to fix
It maintains more pure and exact flow of data through the react application. If the view is using transaction data, then it needs to subscribe to the transaction in Onyx so that it's assured that the transaction object will never be stale or out-of-date.
Solution
Pass transaction as a parameter to getIOUReportActionDisplayMessage() and get the parameter from withOnyx() in the view component.
changed the title [-]Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/-][+][$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/+]on Mar 14, 2024
we will pass reportActions and reportActionID to the key and we will subscribe to transaction with transactionID we get from the report action's originalMessage.IOUTransactionID and pass the transaction to onPress in the payload when the context menu item is copy to clipboard ( textTranslateKey=='reportActionContextMenu.copyToClipboard') here
What alternative solutions did you explore? (Optional)
for the context menu ,of course we can omit the transaction parameter and continue the current method of fetching transaction as we are currently doing because we don't have stale data worry for it as the function will be executed when the user presses copy to clipboard not when context menu component is first rendered 👍
Please re-state the problem that we are trying to solve in this issue.
Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter
What is the root cause of that problem?
Enhancement
What changes do you think we should make in order to solve the problem?
We need to pass transaction from these two places, in ReportActionItemMessage we can use withOnyx & in ContextMenuActions we need to use Onyx.connect.
We will use reportAction.originalMessage.IOUTransactionID to get the data fro Onyx.
Instead of adding additional prop, we can utilize the transactions we have in ReportUtils, we have already connected to Onyx for transactions. We can use it like
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
changed the title [-][HOLD for payment 2024-04-15] [$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/-][+][PAID] [$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/+]on Apr 17, 2024
Activity
[-]Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/-][+][$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/+]melvin-bot commentedon Mar 14, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01cae110240999840b
melvin-bot commentedon Mar 14, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (
External)melvin-bot commentedon Mar 14, 2024
Triggered auto assignment to @strepanier03 (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.FitseTLT commentedon Mar 14, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter
What is the root cause of that problem?
Enhancement
What changes do you think we should make in order to solve the problem?
Update
getIOUReportActionDisplayMessageto accept transaction as a parameter instead of thisApp/src/libs/ReportUtils.ts
Lines 4958 to 4959 in 02e8025
and pass transaction from
withOnyx(using transactionIDaction.originalMessage.IOUTransactionID) for REportactionItem hereAnd for context menu action we will subscribe to transaction in here
App/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Lines 280 to 284 in 02e8025
we will pass
reportActionsandreportActionIDto the key and we will subscribe to transaction with transactionID we get from the report action'soriginalMessage.IOUTransactionIDand pass the transaction toonPressin thepayloadwhen the context menu item is copy to clipboard ( textTranslateKey=='reportActionContextMenu.copyToClipboard') hereApp/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx
Lines 264 to 265 in 02e8025
and we will pass the transaction when we call getIOUReportActionDisplayMessage
App/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Lines 366 to 367 in 02e8025
What alternative solutions did you explore? (Optional)
for the context menu ,of course we can omit the transaction parameter and continue the current method of fetching transaction as we are currently doing because we don't have stale data worry for it as the function will be executed when the user presses copy to clipboard not when context menu component is first rendered 👍
allgandalf commentedon Mar 14, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter
What is the root cause of that problem?
We want to update
getIOUReportActionDisplayMessageasgetTransactionis depricatedApp/src/libs/ReportUtils.ts
Line 4928 in aca0f8c
What changes do you think we should make in order to solve the problem?
First we need to update
getIOUReportActionDisplayMessageto accept one additional prop :Then remove the
reportActionreferences as we get it from component:App/src/libs/ReportUtils.ts
Lines 4958 to 4959 in aca0f8c
Finally we need to get
transactionparameter withwithOnyxin each component and pass it, currently we usegetIOUReportActionDisplayMessagein :App/src/pages/home/report/ReportActionItemMessage.tsx
Line 61 in aca0f8c
App/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Line 366 in aca0f8c
What alternative solutions did you explore? (Optional)
N/A
Krishna2323 commentedon Mar 14, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter
What is the root cause of that problem?
Enhancement
What changes do you think we should make in order to solve the problem?
We need to pass transaction from these two places, in
ReportActionItemMessagewe can usewithOnyx& inContextMenuActionswe need to useOnyx.connect.We will use
reportAction.originalMessage.IOUTransactionIDto get the data froOnyx.App/src/pages/home/report/ReportActionItemMessage.tsx
Line 61 in 2737e44
App/src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Line 366 in 2737e44
Here we need to accept transaction prop and remove the line.
App/src/libs/ReportUtils.ts
Lines 4925 to 4928 in 2737e44
App/src/libs/ReportUtils.ts
Line 4958 in 2737e44
Result
Alternative
Instead of adding additional prop, we can utilize the transactions we have in
ReportUtils, we have already connected to Onyx for transactions. We can use it likeApp/src/libs/ReportUtils.ts
Lines 499 to 509 in 2737e44
allgandalf commentedon Mar 14, 2024
Updated Proposal
Removed the reference of
reportActionfrom the new function in my proposal38 remaining items
melvin-bot commentedon Apr 8, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-04-15. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Apr 8, 2024
strepanier03 commentedon Apr 16, 2024
@hoangzinh - Please complete the checklist as soon as you can and then I'll handle your payment.
@FitseTLT - I've paid your contract and closed it in Upwork, thanks!
hoangzinh commentedon Apr 17, 2024
Hi @strepanier03 we don't have a checklist for this issue because it's not a bug fix but a technical improvement.
hoangzinh commentedon Apr 17, 2024
oh @tgolen @FitseTLT we still have another follow-up task here #38882 (comment)
tgolen commentedon Apr 17, 2024
strepanier03 commentedon Apr 17, 2024
Thanks @hoangzinh for clarification 🙌.
[-][HOLD for payment 2024-04-15] [$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/-][+][PAID] [$500] Update getIOUReportActionDisplayMessage() to accept the transaction as a parameter[/+]strepanier03 commentedon Apr 17, 2024
Okay, this is all paid out and contracts are closed. Thank you both, @hoangzinh and @FitseTLT, for your work on this.