-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 2023-11-01] [HOLD for payment 2023-10-13] [$500] Chat - App displays mention suggestion for sometime when we remove space from before @ #28170
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0193240eea08f27c8d |
Triggered auto assignment to @zanyrenney ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @stephanieelliott ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.The mentions suggestion appears for a moment when the symbol before "@" is removed. What is the root cause of that problem?The root cause is in this hook: App/src/pages/home/report/ReportActionCompose/SuggestionMention.js Lines 235 to 237 in 26cd27f
It is supposed to run only when the
This leads to the The hook is called 2 times on every change:
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: App/src/pages/home/report/ReportActionCompose/SuggestionMention.js Lines 220 to 224 in 26cd27f
What changes do you think we should make in order to solve the problem?We should execute this hook only if the 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]); What alternative solutions did you explore? (Optional)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 |
📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
@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? |
Here's the conversation, unfortunately it doesn't get the responses quite frequently: |
@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. In
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);
+ // We want this hook to run only on selection change.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [selection.end]);
- }, [selection, calculateMentionSuggestion]);
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: Simulator.Screen.Recording.-.iPhone.15.-.2023-10-17.at.16.06.15.mp4 |
Please test #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 |
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 @cubuspl42 please test when you have a spare minute. The changes are in the branch already (with some debugging logs for the moment). |
@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 ? Screen.Recording.2023-10-18.at.16.23.57.movIt's almost the same dependencies set as in current production – the |
@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 had the exact same situation at some point😅 |
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 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.90-2 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-11-01. 🎊 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:
|
@cubuspl42 requires payment offer (Reviewer) - paid $500 no bonus as 15 days elapsed. all payments complete. Closing! |
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
suggestion.before.@.on.space.remove.windows.chrome.mp4
suggestion.before.@.on.space.remove.android.mp4
suggestion.before.@.on.space.remove.mac.desktop.mac.chrome.ios.both.mov
Recording.4759.mp4
Screen_Recording_20230928_080226_New.Expensify.1.mp4
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
The text was updated successfully, but these errors were encountered: