-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2024-04-15] [$250] Remove deprecated ReportUtils.getPolicy()
method
#38959
Comments
Job added to Upwork: https://www.upwork.com/jobs/~010ae8bb081ab888f1 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
Triggered auto assignment to @CortneyOfstad ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated ReportUtils.getPolicy() method What is the root cause of that problem?Remove deprecated ReportUtils.getPolicy() method What changes do you think we should make in order to solve the problem?Steps:
Note: For components we will use Result |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated ReportUtils.getPolicy() method What is the root cause of that problem?Remove deprecated ReportUtils.getPolicy() method. What changes do you think we should make in order to solve the problem?we need to remove the App/src/components/SettlementButton.tsx Line 142 in 0047ad2
and, here
and replace it with oynx similar to the following snippet withOnyx({
policy: {
key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY}${route.params.policyID}`,
},
}) then here Line 75 in cb71f33
Onyx.connect on top to get the policy using the given id.
also we need to the do same in all the occurencies inside the |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated ReportUtils.getPolicy() method What is the root cause of that problem?Identify the usage of What changes do you think we should make in order to solve the problem?After that we need to :
What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated What is the root cause of that problem?Since What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated ReportUtils.getPolicy() method What is the root cause of that problem?What changes do you think we should make in order to solve the problem?
App/src/components/SettlementButton.tsx Line 262 in d8361ee
OPTION: We can create a local function in action file to get the policy with
What alternative solutions did you explore? (Optional)NA |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove deprecated ReportUtils.getPolicy() method What is the root cause of that problem?ReportUtils.getPolicy() is called from a view component and other action files which is an anti-pattern. What changes do you think we should make in order to solve the problem?We should do the next changes in SettlementButton component: Add the prop policy like:
Receive as a param the policy like:
Remove the line: App/src/components/SettlementButton.tsx Line 142 in 0047ad2
Also we should remove the export of the function 'getPolicy' of ReportUtils.ts Additionally we should reuse the function getPolicity in Policy.ts and replace all the lines with 'ReportUtils.getPolicy(policyID)' by 'getPolicy(policyID)'. Later we should make the next changes in WorkspaceJoinUserPage: Add policy prop:
Add the policy param to the function: Add the policy prop inside withOnyx:
Add this to EnforceActionExportRestrictions inside of ReportUtils section:
Lastly we should modify NextStepUtils.ts as indicated below:
Adding this:
And replacing the 'ReportUtils.getPolicy' by the new function called 'getPolicy' This last modifications should be similar in IOU.ts file, except by the OnyxTypes, should be not imported just using like OnyxTypes.Policy. This is the temporary/draft PR to try out: #38976 |
@eVoloshchak — we have quite a few proposals above. Can you provide feedback by EOD? Thanks! |
It doesn't neatly fit into any waves or VIP. This task is cleaning up some
deprecated code in order to maintain code quality.
…On Tue, Mar 26, 2024 at 9:25 AM Cortney Ofstad ***@***.***> wrote:
@tgolen <https://github.com/tgolen> I reviewed all of the linked PRs in
the main issue you linked (#27262
<#27262>) and I wasn't able to
find a connection to any Waves or VIPs. Can you provide some context into
whether or not this falls into one of those classifications? Thanks!
—
Reply to this email directly, view it on GitHub
<#38959 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJMABZG7UR2UTNT37NC5ATY2GHP7AVCNFSM6AAAAABFHWBTBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRQG4ZTSNBRGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sounds good, thanks @tgolen! |
@eVoloshchak are you able to take a look at the proposals? If not today, I will reassign this tomorrow. |
I am happy to take over this issue if he isn't available |
@DylanDylann Can you please take this one? Thank you! I will reassign it. |
📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@nkdengineer Why do you think this point is necessary here?
|
@DylanDylann This is a requirement here. |
Waiting for @nkdengineer's PR to be ready for review |
@nkdengineer @DylanDylann @tgolen Seems regression from this PR where the join workspace flow turns to an infinite loading and doesn't make API Screen.Recording.2024-04-05.at.19.37.17.mov |
ReportUtils.getPolicy()
methodReportUtils.getPolicy()
method
|
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:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@DylanDylann Create a follow up PR here #39991 to fix the bug that is mentioned by @Pujan92 above #38959 (comment). |
So there was a regression, so this will result in a price of $250 instead of $500 for both @DylanDylann and @nkdengineer. @DylanDylann can you handle the checklist here by EOD? @nkdengineer I sent you a manual offer in Upwork. Please let me know once you accept 👍 |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed: [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA |
This is clean up issue, so I think we don't need regression test step |
Sounds good @DylanDylann! |
Payment Summary@DylanDylann — paid $250 via Upwork |
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.getPolicy()
is called from a view component and other action files which is an anti-pattern.Why this is important to fix
It maintains a more pure and exact flow of data through the react application. If the view is using policy data, then it needs to subscribe to the policy in Onyx so that it's garaunteed that the data will never be stale or out-of-date.
Solution
withOnyx()
to load the data in view componentsOnyx.connect()
to load the data in other action filesReportUtils.getPolicy()
or at least prevent it from being exported by adding a test to https://github.com/Expensify/App/blob/main/tests/actions/EnforceActionExportRestrictions.tsUpwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @CortneyOfstadThe text was updated successfully, but these errors were encountered: