-
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
[$250] Remove the getTripTransactions
method
#55077
Comments
Triggered auto assignment to @isabelastisser ( |
Job added to Upwork: https://www.upwork.com/jobs/~021877740338376092500 |
getTripTransactions
methodgetTripTransactions
method
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
@tgolen You need to assign me for review as no one has trip rooms set up right now. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Make changes in getTripTransactions() so it will use reports using withOnyx() instead of Onyx.connect What is the root cause of that problem?Improvement remove getTripTransactions and use withOnyx() What changes do you think we should make in order to solve the problem?
Lines 8175 to 8183 in 3541c89
changes in both the components
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?What alternative solutions did you explore? (Optional) |
github123 Your proposal will be dismissed because you did not follow the proposal template. |
ProposalPlease re-state the problem that we are trying to solve in this issue.When getTripTransactions() is called directly in the component, it accesses Onyx data that the component is not connected to. This breaks reactivity because the component won't re-render when the underlying transactions data changes in Onyx, leading to stale data being displayed to users. What is the root cause of that problem?The root cause is that we're accessing Onyx data through a utility function without establishing a proper subscription to that data. What changes do you think we should make in order to solve the problem?Instead of calling getTripTransactions() directly, we should connect to the data using useOnyx with a selector that utilizes the existing utility function. Like this:
and here:
write it like this: const [tripTransactions] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {
selector:(reports)=> ReportUtils.getTripTransactions(reports, chatReport?.reportID),
}); and accept reports as param in the getTripTransactions What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?What alternative solutions did you explore? (Optional) |
📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
I am sorry everyone. But this will be handled by @blazejkustra since you don't have access to trip rooms. |
@blazejkustra Please comment here so we can get you assigned. |
Commenting for assigment. |
Sorry, I didn't realize this was a locked-down feature! |
@shubham1206agra @blazejkustra, can you please provide an update? What are the next steps? Thanks! |
Sorry, I had other tasks that required my attention. I'm starting to work on this one now!
@tgolen I assume you meant to use |
Ah, haha, yes. |
@tgolen Draft PR is up, please let me know if it’s in line with what you had in mind! I found another issue though, and I'm not sure what is the best approach to fixing it and I'd be glad to hear your thoughts (also cc @rlinoz @shubham1206agra). Basically, whenever you make a reservation, a report action is added to the workspace chat with a trip preview ( It doesn't work right after I sign in, this is because the nested trips aren't fetched from the backend: In order to see them I have to click on 'View trip', which as a side effect calls OpenReport for the trip: Any idea how to fix it? Maybe there is a similar flow in the app already. |
This is the same as report previews right? I think the fix is to return the reports either on |
Sounds like a backend fix needs to be done for that, yeah. I'll cc @stitesExpensify about it so he is aware of the issue. |
Update: PR is under review |
Coming from #54965 (comment)
Problem
When
getTripTransactions()
is called, it accesses data from Onyx that the view is not connected to. This breaks the reactivity of the component because when the transactions are updated in Onyx, the component won't receive the changes. This leads to stale data.Solution
Remove
getTripTransactions()
and connect to the data usinguseOnyx()
instead.Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @s77rtThe text was updated successfully, but these errors were encountered: