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

Chat - Compose box reappears when trying to edit a message, exit the chat and go to it again #31238

Closed
3 of 6 tasks
kbecciv opened this issue Nov 11, 2023 · 9 comments
Closed
3 of 6 tasks
Assignees

Comments

@kbecciv
Copy link

kbecciv commented Nov 11, 2023

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.3.98.0
Reproducible in staging?: y
Reproducible in production?: n
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: Applause - Internal Team
Slack conversation:

Action Performed:

Pre-requisite: user must be logged in.

  1. Go to any chat.
  2. Long tap on any sent message.
  3. Tap on "Edit comment".
  4. Verify the compose box gets hidden.
  5. Tap on the back button to go to LHN.
  6. Go to the same chat again.

Expected Result:

The compose box should be still hidden.

Actual Result:

The compose box reappears.

Workaround:

Unknown

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

Bug6272557_1699717281656.Etjm7964_1_.mp4

View all open jobs on GitHub

@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Nov 11, 2023
@OSBotify
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 Nov 11, 2023

Triggered auto assignment to @puneetlath (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 12, 2023

Proposal

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

  • Chat - Compose box reappears when trying to edit a message, exit the chat and go to it again

What is the root cause of that problem?

  • Currently, clicking on the back button will blur the edit composer. In onBlur callback, we call setShouldShowComposeInputKeyboardAware(true)
    onBlur={(event) => {
    setIsFocused(false);
    const relatedTargetId = lodashGet(event, 'nativeEvent.relatedTarget.id');
    if (_.contains([messageEditInput, emojiButtonID], relatedTargetId)) {
    return;
    }
    setShouldShowComposeInputKeyboardAware(true);
    }}
  • So when we come to this report again, the composer reappears

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

  1. Create a global object editingReportActionIDs to keep track the editing reportActionID. editingReportActionIDs is an object like
 editingReportActionIDs: {
        'reportID1': 'reportActionID1',
        'reportID2': 'reportActionID2',
    }
  1. Once we focused on the edit composer, set global editingReportActionID to the current reportActionID by updating:

    to
                          onFocus={() => {
                                editingReportActionIDs[props.report.reportID] = props.action.reportActionID;
  1. Once we blur this edit composer, clear the global editingReportActionIDs with the delay. We only clear the editingReportActionIDs[props.report.reportID] in case the report is still mounted. Do it by updating:

    to
                            onBlur={(event) => {
                                clearEditingReportActionIDWithDelay(null);

with clearEditingReportActionIDWithDelay is defined as below:

    const isMountedRef = useRef(false);
    useEffect(() => {
        isMountedRef.current = true;
        return () => {
            isMountedRef.current = false;
        };
    }, []);

    const clearEditingReportActionIDWithDelay = useCallback((value: string | null) => {
        setTimeout(() => {
            if (isMountedRef.current) {
                editingReportActionIDs[props.report.reportID] = null
            }
        }, 500);
    }, []);

What alternative solutions did you explore? (Optional)

  • Also we can consider using ONYX to store the above global object editingReportActionIDs

Result

Screencast.from.12-11-2023.14.07.34.webm

@situchan
Copy link
Contributor

Seems like regression from #31041

@narefyev91
Copy link
Contributor

Seems like regression from #31041

It's not a regression from linked pr #31041 - i rolled back locally all those changes - and issue is still reproduced. I'm not even sure that such behaviour was fixed somewhere
Just a closely area - this PR - #27190
Issue has already been happened there
Screenshot 2023-11-13 at 13 38 09

@s77rt
Copy link
Contributor

s77rt commented Nov 13, 2023

This does not seem to be a bug. When you exit the chat the edit composer is blurred. Going back you are expected to see the main composer.

If you ever open a chat and didn't find the main composer this can be more frustrating as you may not find the edit composer either (e.g. received new messages that pushed the message you were editing up - no longer in view)

@situchan
Copy link
Contributor

Since this is marked as deploy blocker, curious how this behaves in production right now

@s-alves10
Copy link
Contributor

I don't think this is a bug

@melvin-bot melvin-bot bot added the Overdue label Nov 14, 2023
@roryabraham roryabraham removed the DeployBlockerCash This issue or pull request should block deployment label Nov 14, 2023
@roryabraham
Copy link
Contributor

Not a bug

@melvin-bot melvin-bot bot removed the Overdue label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants