-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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] [Wave Collect] As we switch between the features of Collect workspace the read api commands are not triggered everytime #38378
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01fe46178cda4b28aa |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
Triggered auto assignment to @lschurr ( |
Upwork job price has been updated to $250 |
ProposalPlease re-state the problem that we are trying to solve in this issue.When the feature page is open a read API command should get triggered to make sure all the data are up-to-date. What is the root cause of that problem?Currently we don't have any logic to trigger the read API command when the page is opened, only when it's mounted for the first time. What changes do you think we should make in order to solve the problem?Add logic to trigger the read API command when the page is opened, we can use
Or we can refactor a bit by removing the "trigger read API command" logic on mount like here, and rely totally in
We should apply similar logic to all the feature page (or if not required in all, in those pages that we want the behavior). Each feature page will have 1 such "trigger read command" method, like here or here What alternative solutions did you explore? (Optional)NA |
ProposalPlease re-state the problem that we are trying to solve in this issueAs we switch between the pages of Collect workspace via LHN on large screen devices, the API read calls are not triggered reliably. What is the root cause of that problem?Note This works as expected (not reproducible) on narrow layout devices (mweb / native) where LHN is its own page (in the navigation stack) instead of a sidebar with the pages opening on the right side of the LHN. The issue arises due to the way component lifecycle works in conjunction with React Navigation on large screen devices. On narrow layout devices each LHN menu item opens a new page (in the navigation stack) which causes the component to always mount -> triggering the Conversely, on large screens where LHN acts as a sidebar, the pages are not always unmounting when navigating to another page by clicking on another LHN menu item, having the components remain mounted in the DOM -> leading to the What changes do you think we should make in order to solve the problem?Given how the navigation logic was implemented within the For this we have to replace the menu item - Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(policyID))
+ Navigation.goBack(ROUTES.WORKSPACE_PROFILE.getRoute(policyID), true, true) Note We will replace the navigation function in the same way for all LHN menu item pages:
To better understand what all the Spoiler (open)/**
* @param fallbackRoute - Fallback route if pop/goBack action should, but is not possible within RHP
* @param shouldEnforceFallback - Enforces navigation to fallback route
* @param shouldPopToTop - Should we navigate to LHN on back press
*/
function goBack(fallbackRoute?: Route, shouldEnforceFallback = false, shouldPopToTop = false) {
//...existing logic Important By implementing this solution we ensure that on large screen devices where LHN acts as a sidebar, whenever we click on a LHN menu item we always unmount ( VideosMacOS: Chrome / Safari
What alternative solutions did you explore? (Optional)Warning The alternative solution would be using navigation focus as suggested by #38378 (comment), but this would not work for the case where say I'm already on the Profile page and I click the LHN Profile menu item again and again -> the API read call would not be made since there's no previous / current page focus change. |
ProposalPlease re-state the problem that we are trying to solve in this issue.As we switch between the features of Collect workspace the read api commands are not triggered everytime What is the root cause of that problem?We only fetch data on mount, and the screen is not always unmounted in React Navigation. What changes do you think we should make in order to solve the problem?We can refetch the data when it is refocused. We can combine useFocusEffect with useCallback to optimize it. Replace onMount useEffect with this to each menu page.
Or
This can be applied to all menu features What alternative solutions did you explore? (Optional) |
Waiting for C+ review @eVoloshchak |
Thank you all for the proposals! Ultimately there are two ways to resolve the issue
Both approaches do resolve the issue, however I'm a bit wary of using 🎀👀🎀 C+ reviewed! |
Current assignee @mountiny is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
Thanks @eVoloshchak I agree with your conclussion |
📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@eVoloshchak, the solution to this issue is straightforward, and I believe a little optimization could make a difference. In this case, useFocusEffect not only provides an efficient and optimized approach to managing side effects in React but also enhances code readability. Would you please reconsider? |
Thanks for the assignment! I'll open the PR shortly 👍
@wildan-m That's something that can be handled in the PR phase. Code diff were only provided as example for ease of testing, the core approach here is "call the API when the page is focused", and yours are the same.
For something that is called only once when entering a page, there'll be no noticeable difference. |
If the decision is final, that's fine.
@tienifr By the way, that doesn't belong to you either, it's already identified in the original post link. #38135 (comment). |
PR ready for review #38613. |
|
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 adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@eVoloshchak - Do we need a regression test for this one? |
Payment summary:
|
Regression Test Proposal
Do we agree 👍 or 👎 |
$250 approved for @eVoloshchak |
Problem
As you can see in the video here #38135 (review), in Collect workspace (needs to be created from OldDot) settings in NewDot, user has multiple features admin can open in the LHP.
When the feature page is open a read API command should get triggered to make sure all the data are up-to-date.
But as you can see it does not happen reliably. @fabioh8010 has investigated and left some information here #38135 (comment)
Solution
Fix this for all the workspace pages so opening the page will always call the appropriate API command.
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: