Closed kbecciv closed 1 year ago
Job added to Upwork: https://www.upwork.com/jobs/~0193240eea08f27c8d
Triggered auto assignment to @zanyrenney (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are β
)Triggered auto assignment to @stephanieelliott (External
), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (External
)
The mentions suggestion appears for a moment when the symbol before "@" is removed.
The root cause is in this hook:
It is supposed to run only when the selection
changes. However, calculateMentionSuggestion
is also in the dependencies list of this hook. And this function has the value in its dependencies list:
This leads to the calculateMentionSuggestion
function being changed every time a value
is changed. And therefore the initial hook is called on every selection
& value
change.
The hook is called 2 times on every change:
value
but previous selection
value
and new selection
As a result, on step 1, the cursor is calculated as standing after the "@" sign:
And the menu becomes visible in this chunk of code until the step 2 takes place:
We should execute this hook only if the selection
has changed:
Option 1 (preferred, although not lint-friendly):
useEffect(() => {
calculateMentionSuggestion(selection.end);
+ // we want this hook to run only on selection change
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [selection]);
- }, [selection, calculateMentionSuggestion]);
Option 2 (lint-friendly, but with more complex checks):
const prevSelection = usePrevious(selection);
const didSelectionChange = !_.isEqual(prevSelection, selection);
useEffect(() => {
if (!didSelectionChange) {
return;
}
calculateMentionSuggestion(selection.end);
}, [didSelectionChange, selection, calculateMentionSuggestion]);
dupe assignment, i got this @stephanieelliott - unassigning you.
I approve the proposal by @paultsimura. The RCA looks fine, and the fix is simple.
C+ reviewed π π π
Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Solution looks good to me. Assigning now.
π£ @cubuspl42 π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @paultsimura π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
π£ @dhanashree-sawant π An offer has been automatically sent to your Upwork account for the Reporter role π Thanks for contributing to the Expensify app!
Thanks, the PR is ready for review.
π― β‘οΈ Woah @cubuspl42 / @paultsimura, great job pushing this forwards! β‘οΈ
The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus π
On to the next one π
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.76-6 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-10-10. :confetti_ball:
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:
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:
Crossposting that a regression has been identified: https://github.com/Expensify/App/issues/28657
Updated Hold
period to match the payout date of the regression.
@stephanieelliott I don't think we're eligible for payment here, at least for now. We had to revert the solution, and we're still investigating other options that will both solve this issue and don't have undesired side effects.
The fact that this is related to a bug in React Native itself doesn't help.
@paultsimura What's the latest status here? I know you've been discussing this on Slack
Yep, i think you're right @cubuspl42 this wouldn't qualify for payment. Let's link the slack conversation if there is one?
Yep, i think you're right @cubuspl42 this wouldn't qualify for payment. Let's link the slack conversation if there is one?
Here's the conversation, unfortunately it doesn't get the responses quite frequently: https://expensify.slack.com/archives/C01GTK53T8Q/p1696421170146759
@paultsimura Did we explore the "Option 2 (lint-friendly, but with more complex checks)"? Does it also has the undesired side-effects?
@cubuspl42 unfortunately yes, it had the same side-effect. However, I've come up with a new workaround approach that seem to do the job. Would you be able to test this approach anytime soon?
In SuggestionMention
:
const [shouldRecalculateSuggestions, setShouldRecalculateSuggestions] = useState(false);
useEffect(() => {
+ if (selection.end > 0 && !lodashGet(value, 'length', 0)) {
+ // This is a workaround for a known issue with iOS' first input.
+ // See: https://github.com/facebook/react-native/pull/36930#issuecomment-1593028467
+ setShouldRecalculateSuggestions(true);
+ }
calculateMentionSuggestion(selection.end);
Add a new hook:
useEffect(() => {
// This hook solves the issue with iOS' first input:
// It enables showing the mention suggestions after the user enters '@' as a first char in the Composer.
// See: https://github.com/facebook/react-native/pull/36930#issuecomment-1593028467
if (!shouldRecalculateSuggestions) {
return;
}
setShouldRecalculateSuggestions(false);
calculateMentionSuggestion(selection.end);
// We want this hook to run only on value change.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);
This will allow handling the regression that was discovered, when the first input in RN iOS is handled in the wrong order:
https://github.com/Expensify/App/assets/12595293/802b436a-5477-4b66-b642-3164c77c9624
Please test https://github.com/Expensify/App/issues/28749 with the proposed solution
who are you asking to test @shubham1206agra - please add the specific user you are directing your comments too so that we can understand better and keep pushing this forward with urgency?
@paultsimura Do you have a Git branch with these changes at hand?
@cubuspl42 here it is: https://github.com/paultsimura/Expensify/tree/fix/28170-mention-on-delete However, @shubham1206agra is right β this brings back the https://github.com/Expensify/App/issues/28749. Working on it...
Ok, seems like I have a workaround that covers all the cases I currently know. It's not elegant, but it's working:
+ const previousValue = usePrevious(value);
useEffect(() => {
+ if (value.length < previousValue.length) {
+ return;
+ }
calculateMentionSuggestion(selection.end);
}, [selection, calculateMentionSuggestion]);
Since the hook is called 2 times: on value
change and on selection
change, it's safe to early return on deletion βΒ in this case, only the correct update of value and selection should trigger the suggestions. On the input, the hook will still be called 2 times, so both normal (non-iOS) and buggy iOS flows should be covered.
@cubuspl42 please test when you have a spare minute. The changes are in the branch already (with some debugging logs for the moment). cc: @shubham1206agra
@paultsimura This might be working! But would you also test this branch and share your thoughts?
@paultsimura This might be working! But would you also test this branch and share your thoughts?
Unfortunately, the branch doesn't solve the current issue, does it work for you @cubuspl42 ?
https://github.com/Expensify/App/assets/12595293/8ece5d60-86ea-4658-9286-9688e8da785e
It's almost the same dependencies set as in current production β the calculateMentionSuggestion
in our hook's dependencies changes with every value
change (which is in calculateMentionSuggestion
's dependencies list). So replacing calculateMentionSuggestion
with value
eventually doesn't change anything, as far as I can see π€
But would you also test this branch and share your thoughts?
@paultsimura Forget this. This doesn't work, as you observed. I tried really many work-around ideas (none worked) and I think I forgot what problem I'm workarounding in the end, however dumb that sounds.
I forgot what problem I'm workarounding in the end
I had the exact same situation at some pointπ It was because I was trying to find a workaround that solves all the issues at once. But after none of them worked, moved to just straightforward "don't show suggestions on removal" workaround.
You can file a PR with your best idea so far, we can move the discussion there
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one π
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.90-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-11-01. :confetti_ball:
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:
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:
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
App should not display suggestions on removing space before @
Actual Result:
App displays suggestions on removing space before @ for sometime
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.74.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
https://github.com/Expensify/App/assets/93399543/48d46156-7678-4827-a5dc-acb1af90ffe6
https://github.com/Expensify/App/assets/93399543/964e79e3-c452-4a51-b98b-05f42af1c718
https://github.com/Expensify/App/assets/93399543/1d46c808-c5db-4984-b8c4-1968426e3510
https://github.com/Expensify/App/assets/93399543/92c8c795-b9a4-4cdc-85e2-bcc05b9b4df9
https://github.com/Expensify/App/assets/93399543/969a841a-f864-4c6f-994e-fb09deb6df17
Expensify/Expensify Issue URL: Issue reported by: @dhanashree-sawant Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695458107547879
View all open jobs on GitHub
Upwork Automation - Do Not Edit