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
[HOLD for payment 2023-09-27] [$500] IOS - Mention list open again after requesting money #26534
Go back to LHN, click Plus button and choose request money, request any amount to the above report.
Repeat above steps few times.
Notice that mention list is opened even composer is not focused.
Expected Result:
If composer is not focused, mention list shouldn't be opened.
Actual Result:
Mention list is opened even when composer is not focused.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.61.0 Reproducible in staging?: y Reproducible in production?: y 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 Notes/Photos/Videos: Any additional supporting documentation
Please re-state the problem that we are trying to solve in this issue.
The Mentions list opens again after requesting money even if the composer is not focused.
What is the root cause of that problem?
The onSelectionChange event handler in ComposerWithSuggestions triggers a recalculation of the suggestions by calling suggestionsRef.current.onSelectionChange(e). Based on the implementation of the onSelectionChange from the current suggestion ref, this recalculation ends up rendering the mentions list even when the text input is not focused.
Additionally, The Suggestions component in ComposerWithSuggestions is not conditionally rendered based on whether or not the composer currently has focus.
What changes do you think we should make in order to solve the problem?
Solution 1
In the onSelectionChange handler for the ComposerWithSuggestions component, perform an early return if the text input ref is not currently focused.
Solution 2
Conditionally render the Suggestions component using ReportActionComposeFocusManager.isFocused(), or using a local state variable which tracks whether or not the composer is currently focused.
changed the title [-]IOS - Mention list open again after requesting money[/-][+][$500] IOS - Mention list open again after requesting money[/+]on Sep 5, 2023
changed the title [-][$500] IOS - Mention list open again after requesting money[/-][+][HOLD for payment 2023-09-27] [$500] IOS - Mention list open again after requesting money[/+]on Sep 20, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.71-12 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 2023-09-27. 🎊
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
External issue reporter
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
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:
[@cubuspl42] The PR that introduced the bug has been identified. Link to the PR:
[@cubuspl42] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@cubuspl42] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@cubuspl42] Determine if we should create a regression test for this bug.
[@cubuspl42] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@tjferriss] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
No need for additional discussion
Determine if we should create a regression test for this bug.
No need for a new regression test
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Activity
melvin-bot commentedon Sep 1, 2023
Triggered auto assignment to @tjferriss (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 1, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)akinwale commentedon Sep 1, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The Mentions list opens again after requesting money even if the composer is not focused.
What is the root cause of that problem?
The
onSelectionChangeevent handler in ComposerWithSuggestions triggers a recalculation of the suggestions by callingsuggestionsRef.current.onSelectionChange(e). Based on the implementation of theonSelectionChangefrom the current suggestion ref, this recalculation ends up rendering the mentions list even when the text input is not focused.App/src/pages/home/report/ReportActionCompose/SuggestionMention.js
Line 236 in 1849ab1
Additionally, The
Suggestionscomponent in ComposerWithSuggestions is not conditionally rendered based on whether or not the composer currently has focus.What changes do you think we should make in order to solve the problem?
Solution 1
In the
onSelectionChangehandler for theComposerWithSuggestionscomponent, perform an early return if the text input ref is not currently focused.const onSelectionChange = useCallback( (e) => { + if (!textInputRef.current.isFocused()) { + return; + } if (suggestionsRef.current.onSelectionChange(e)) { return; } setSelection(e.nativeEvent.selection); }, [suggestionsRef], );Solution 2
Conditionally render the
Suggestionscomponent usingReportActionComposeFocusManager.isFocused(), or using a local state variable which tracks whether or not the composer is currently focused.Also update the areas where
suggestionsRef.currentis being used to prevent crash errors due to trying to access a null / undefined ref.What alternative solutions did you explore? (Optional)
None.
26534-demo.mp4
melvin-bot commentedon Sep 5, 2023
@tjferriss Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
[-]IOS - Mention list open again after requesting money[/-][+][$500] IOS - Mention list open again after requesting money[/+]melvin-bot commentedon Sep 5, 2023
Job added to Upwork: https://www.upwork.com/jobs/~014c468cc852a95d2d
melvin-bot commentedon Sep 5, 2023
Current assignee @tjferriss is eligible for the External assigner, not assigning anyone new.
tjferriss commentedon Sep 5, 2023
I was able to reproduce the bug on staging.
25 remaining items
[-][$500] IOS - Mention list open again after requesting money[/-][+][HOLD for payment 2023-09-27] [$500] IOS - Mention list open again after requesting money[/+]melvin-bot commentedon Sep 20, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Sep 20, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.71-12 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 2023-09-27. 🎊
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
melvin-bot commentedon Sep 20, 2023
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:
jakub-trzebiatowski commentedon Sep 21, 2023
tjferriss commentedon Sep 25, 2023
Payment Summary:
Eligible for the 50% speed bonus
tjferriss commentedon Sep 29, 2023
Everyone has been paid out via Upworks. Closing!