Skip to content
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-09] [$500] Composer defocuses when editing parent message in thread #38878

Closed
4 of 6 tasks
kbecciv opened this issue Mar 23, 2024 · 32 comments
Closed
4 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Mar 23, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.56-0
Reproducible in staging?: y
Reproducible in production?: n
Issue found when executing PR: #37566
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com.
  2. Go to any chat.
  3. Send a message containing inline image markdown. Example:
    An inline image and some text off
  4. Right click on the message > Edit comment.
  5. Focus the cursor anywhere in the editor.
  6. Note that the composer will not defocus.
  7. Right click on the message > Reply in thread.
  8. Right click on the parent message > Edit comment.
  9. Focus the cursor anywhere in the editor.

Expected Result:

The composer will not defocus.

Actual Result:

The composer defocuses when editing message with inline image mark down in thread.

Workaround:

n/a

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6424058_1711173003900.20240323_134637.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012dd2062cbe841507
  • Upwork Job ID: 1772340169085984768
  • Last Price Increase: 2024-03-25
  • Automatic offers:
    • jjcoffee | Reviewer | 0
    • bernhardoj | Contributor | 0
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Mar 23, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Mar 23, 2024

Triggered auto assignment to @amyevans (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@kbecciv
Copy link
Author

kbecciv commented Mar 23, 2024

We think that this bug might be related to #vip-bills

@amyevans
Copy link
Contributor

This is related to a new feature and also pretty minor so not worth considering a blocker.

@kidroca do you have bandwidth to take this on and fix as polish? If not I can open it up to external proposals. cc @situchan @marcaaron

@amyevans amyevans added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Mar 25, 2024
@amyevans
Copy link
Contributor

Hmm actually I'm going to walk back my comment that it's related to the Image Markdown PR, I think it was just incidental that it was discovered during QA there. I can reproduce the bug on main with that PR reverted, and I can also reproduce on a comment that does not include image markdown.

Will continue to investigate...

@situchan
Copy link
Contributor

Agree, I am not convinced why composer focus behavior is related to image MD.

@amyevans amyevans added the External Added to denote the issue can be worked on by a contributor label Mar 25, 2024
@melvin-bot melvin-bot bot changed the title Image MD - Composer defocuses when editing message with inline image mark down in thread [$500] Image MD - Composer defocuses when editing message with inline image mark down in thread Mar 25, 2024
Copy link

melvin-bot bot commented Mar 25, 2024

Job added to Upwork: https://www.upwork.com/jobs/~012dd2062cbe841507

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 25, 2024
Copy link

melvin-bot bot commented Mar 25, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (External)

@amyevans amyevans added the Bug Something is broken. Auto assigns a BugZero manager. label Mar 25, 2024
Copy link

melvin-bot bot commented Mar 25, 2024

Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@shubham1206agra
Copy link
Contributor

@amyevans I think this should block deployment here as it breaks crucial feature of editing messages.

@bernhardoj
Copy link
Contributor

bernhardoj commented Mar 26, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

The edit composer of a parent thread message lose focuses when clicking on it.

What is the root cause of that problem?

For the parent thread message, we set an on-press event that will navigate the user to the thread report.

<ReportActionItem
onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID))}

In the video, the thread is 1 level deep, so pressing it will navigate to itself, so the composer loses the focus.

What changes do you think we should make in order to solve the problem?

Don't trigger the on-press when the message is in draft mode.

<PressableWithSecondaryInteraction
ref={popoverAnchorRef}
onPress={onPress}

onPress={!draftMessage ? onPress : undefined}

also, maybe we can improve the thread parent press logic to ignore the press if the report destination is the same as the current report

@shubham1206agra
Copy link
Contributor

@bernhardoj Please link offending PR here.

@bernhardoj
Copy link
Contributor

It's related to the comment linking PR. The navigation triggers this memo to recalculate the ID which is passed to the chat list FlatList key, so the list re-renders every time a navigation happens.

const listID = useMemo(() => {
isFirstLinkedActionRender.current = true;
const newID = generateNewRandomInt(listOldID, 1, Number.MAX_SAFE_INTEGER);
listOldID = newID;
return newID;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [route, isLoadingInitialReportActions]);

We still need to apply my fix, otherwise we can't edit a thread ancestor message.

Screen.Recording.2024-03-26.at.14.24.39.mov

@shahinyan11
Copy link
Contributor

shahinyan11 commented Mar 26, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Image MD - Composer defocuses when editing message with inline image mark down in thread

What is the root cause of that problem?

When we press anywhere in input, the event will bubble up the tree and call the onPress of the parent element here

What changes do you think we should make in order to solve the problem?

Add onClick={(e)=>{e.stopPropagation()}} to this View

What alternative solutions did you explore? (Optional)

Replace this View with PressableWithoutFeedback component. This approach is also used in other places in the application to prevent events from bubbling up the tree (e.g here )

@jjcoffee
Copy link
Contributor

Looks to be caused by the comment linking PR #30269. @bernhardoj's proposal LGTM to get this fixed quickly!

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 26, 2024

Current assignee @amyevans is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@amyevans
Copy link
Contributor

Proposal looks good @bernhardoj, thanks! Let us know when we can expect a PR

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 26, 2024
Copy link

melvin-bot bot commented Mar 26, 2024

📣 @jjcoffee 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Mar 26, 2024

📣 @bernhardoj 🎉 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 📖

@amyevans
Copy link
Contributor

Also cc @perunt @roryabraham (nothing y'all need to do here, just a tag for visibility since this came from comment linking)

@amyevans amyevans changed the title [$500] Image MD - Composer defocuses when editing message with inline image mark down in thread [$500] Composer defocuses when editing parent message in thread Mar 26, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 26, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @jjcoffee

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 2, 2024
@melvin-bot melvin-bot bot changed the title [$500] Composer defocuses when editing parent message in thread [HOLD for payment 2024-04-09] [$500] Composer defocuses when editing parent message in thread Apr 2, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Apr 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.58-8 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-09. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 2, 2024

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:

  • [@jjcoffee] The PR that introduced the bug has been identified. Link to the PR:
  • [@jjcoffee] 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:
  • [@jjcoffee] 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:
  • [@jjcoffee] Determine if we should create a regression test for this bug.
  • [@jjcoffee] 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.
  • [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 8, 2024
@isabelastisser
Copy link
Contributor

@jjcoffee please complete the list above. Thanks!

@isabelastisser
Copy link
Contributor

isabelastisser commented Apr 9, 2024

The payments were processed in Upwork.

Waiting for @jjcoffee to complete the BZ list before this can be closed.

@jjcoffee
Copy link
Contributor

Regression Test Proposal

  1. Send a message to any chat
  2. Right-click and reply in thread to the message
  3. Right-click and edit the thread parent message
  4. Tap anywhere in the message
  5. Verify that the focus on the composer isn't lost

Do we agree 👍 or 👎

@isabelastisser
Copy link
Contributor

Hi @amyevans, do you agree that we should create the regression test with the steps above? Thanks!

@amyevans
Copy link
Contributor

@isabelastisser I think since the bug was caught during normal regression testing by Applause, it means that adding an explicit test case for this would be unnecessary. However if you want to be safe you can always open a GH for it and let Isabella make that call!

@isabelastisser
Copy link
Contributor

Thanks for the context, Amy! I agree and will close it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants