-
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
[Hold for payment 2024-04-30][$250] Workspace switcher - Expensify is no longer bolded and missing RBR after refreshing the page #39928
Comments
Triggered auto assignment to @lschurr ( |
We think that this bug might be related to #vip-vsb |
@lschurr I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
ProposalPlease re-state the problem that we are trying to solve in this issue.Workspace switcher - Expensify is no longer bolded and missing RBR after refreshing the page What is the root cause of that problem?These functions are returning empty object because the moment they are called (on first render) App/src/pages/WorkspaceSwitcherPage.tsx Lines 66 to 67 in ad9b5d7
App/src/libs/WorkspacesSettingsUtils.ts Lines 25 to 26 in ad9b5d7
What changes do you think we should make in order to solve the problem?We need make our calculation depend on a component cycle variable (
What alternative solutions did you explore? (Optional)We have many options to solve it we can remove the memo and make it like this
|
Job added to Upwork: https://www.upwork.com/jobs/~01d57cfb7d1d01cfcd |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 ( |
ProposalPlease re-state the problem that we are trying to solve in this issueAfter refreshing the page:
What is the root cause of that problem?We're memoizing the The two functions coming from Because this is not instant, it causes the memoized functions to always return the data from when
What changes do you think we should make in order to solve the problem?Important We want to preserve the memoization because Therefore I propose adding the const brickRoadsForPolicies = useMemo(() => getWorkspacesBrickRoads(), [reports]);
const unreadStatusesForPolicies = useMemo(() => getWorkspacesUnreadStatuses(), [reports]); By doing this we make sure that we only recalculate the functions when Videos (before / after)MacOS: Chrome / Safari
What alternative solutions did you explore? (Optional)Since Given that both const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const brickRoadsForPolicies = useMemo(() => getWorkspacesBrickRoads(reports, policies), [reports, policies]);
const unreadStatusesForPolicies = useMemo(() => getWorkspacesUnreadStatuses(reports), [reports]); As a clean-up after doing this we can remove the Note Compred to the video results of the first solution or other solutions, this one is instant -> there's no visible UI transition from non-bold to bold or from no RBR/GBR to visible RBR/GBR, check this out: MacOS: Chrome / SafariScreen.Recording.2024-04-11.at.02.46.15.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.After refreshing the page:
What is the root cause of that problem?Both of the functions are memorized App/src/pages/WorkspaceSwitcherPage.tsx Lines 66 to 67 in 342b16d
and will not retrieve new data coming from Onyx.connect App/src/libs/WorkspacesSettingsUtils.ts Lines 22 to 26 in b394f3d
What changes do you think we should make to solve the problem?I propose to wrap Both of them will be similar. We subscribe to connection callback, setting the internal state for retrieved data.
Then we can process the retrieved data (process brick data or determine unread status) and memorize it. Later, in
In this case, we are getting the correct information about reports and policies immediately. No matter if it's on web app start or later in use when we receive updates on reports. What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.State of workspaces like selected option boldness and RBR don't stay consistent after reload What is the root cause of that problem?Currently we use App/src/pages/WorkspaceSwitcherPage.tsx Lines 66 to 67 in ad9b5d7
But during the very first render, these field are undefined as still have received the values of these What changes do you think we should make in order to solve the problem?We already have subscribed to App/src/pages/WorkspaceSwitcherPage.tsx Lines 285 to 288 in ad9b5d7
So we should put const brickRoadsForPolicies = useMemo(() => getWorkspacesBrickRoads(), [policies]);
const unreadStatusesForPolicies = useMemo(() => getWorkspacesUnreadStatuses(), [policies]); Result VideoScreen.Recording.2024-04-11.at.5.00.54.AM.mov |
Updated proposal
|
Reviewing proposals |
Thank you all for your proposals! @ikevin127 's proposal looks good to me. I agree with their RCA and their alternative solution to use the new hook 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @iwiznia, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@eh2077 I really disagree with your choice because the selected proposal doesn't have any significant difference in RCA and also solution than mine which was proposed way before the selected one. Using a |
While debugging this issue, I spotted a bug with It's because
but we provide property App/src/pages/WorkspaceSwitcherPage.tsx Line 136 in 479efd6
Changing line to |
@FitseTLT Thanks for your comment. I would definitely vote for your proposal if useOnyx were just a new syntactic sugar, but it's not. It eliminates the UI transition. So, I tend to stick to my original decision. |
@Skakruk Thank you for sharing your finding! |
@iwiznia All good for assignment here based on #39928 (comment) and #39928 (comment) ? |
📣 @eh2077 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @ikevin127 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
PR #40197 is ready for review! 🎉 |
cc @lschurr |
Thanks @ikevin127! |
Payment summary:
|
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number:
Reproducible in staging?:
Reproducible in production?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:
Action Performed:
Precondition:
Expected Result:
After refreshing the page,
Actual Result:
After refreshing the page,
Workaround:
n/a
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6443113_1712641035847.20240409_133128.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: