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 on #53493] [$250] [ iOS 17.2] App closes when back button pressed on PDF preview #55537

Open
1 of 8 tasks
m-natarajan opened this issue Jan 21, 2025 · 18 comments
Open
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Needs Reproduction Reproducible steps needed

Comments

@m-natarajan
Copy link

m-natarajan commented Jan 21, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.88-4
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @jjcoffee
Slack conversation (hyperlinked to channel name): expensify_bugs

Action Performed:

  1. Add a PDF attachment to any chat
  2. Open the PDF
  3. Press the back button

Expected Result:

Return to the chat.

Actual Result:

App closes.

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
ios-app-2025-01-20_11.10.51.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021883275195164447950
  • Upwork Job ID: 1883275195164447950
  • Last Price Increase: 2025-02-01
Issue OwnerCurrent Issue Owner: @
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed labels Jan 21, 2025
Copy link

melvin-bot bot commented Jan 21, 2025

Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@jjcoffee
Copy link
Contributor

I can repro (I'm the bug reporter), please assign me @MitchExpensify 🙏

@melvin-bot melvin-bot bot added the Overdue label Jan 24, 2025
@melvin-bot melvin-bot bot removed the Overdue label Jan 25, 2025
@MitchExpensify MitchExpensify added External Added to denote the issue can be worked on by a contributor Overdue labels Jan 25, 2025
Copy link

melvin-bot bot commented Jan 25, 2025

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

@melvin-bot melvin-bot bot changed the title [ iOS 17.2] App closes when back button pressed on PDF preview [$250] [ iOS 17.2] App closes when back button pressed on PDF preview Jan 25, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 25, 2025
Copy link

melvin-bot bot commented Jan 25, 2025

Current assignee @jjcoffee is eligible for the External assigner, not assigning anyone new.

@linhvovan29546
Copy link
Contributor

Proposal

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

App closes when back button pressed on PDF preview

What is the root cause of that problem?

We have an AttachmentModal nested inside the ReportAttachments modal (react-navigation).

return (
<AttachmentModal
accountID={Number(accountID)}

When the back button is pressed, the closeModal function is triggered. Inside this function, we first call setIsModalOpen to close the AttachmentModal and then call the onModalClose callback to close the ReportAttachments modal (handled by react-navigation). However, due to asynchronous behavior, the ReportAttachments modal closes before the AttachmentModal, leading to a crash.

This issue can be reproduced with other types of attachments, not just PDFs.

const closeModal = useCallback(
(shouldCallDirectly?: boolean) => {
setIsModalOpen(false);
if (typeof onModalClose === 'function') {
if (shouldCallDirectly) {
onModalClose();
return;
}
attachmentModalHandler.handleModalClose(onModalClose);

Image Image
Detail
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-01-26.at.18.42.25.mp4

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

It seems there is already a plan to migrate modal to react-navigation. We can hold this until the PR for the migration is merged.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

What alternative solutions did you explore? (Optional)

We should close the ReportAttachments modal only after the AttachmentModal has fully closed. This can be achieved by moving the logic to close the ReportAttachments modal into the onModalHide callback.

onModalHide={() => {
if (!isPDFLoadError.current) {
onModalHide();
}

   onModalHide={() => {
...
            if (typeof onModalClose === 'function') {
                if (shouldCallDirectly) {
                    onModalClose();
                    return;
                }
                attachmentModalHandler.handleModalClose(onModalClose);
            }
}

@MitchExpensify
Copy link
Contributor

What do you think about the proposal @jjcoffee ?

@jjcoffee
Copy link
Contributor

Asking for confirmation if this issue will be fixed as part of #53493.

@melvin-bot melvin-bot bot added the Overdue label Jan 30, 2025
@jjcoffee
Copy link
Contributor

Still waiting for confirmation from @chrispader.

@melvin-bot melvin-bot bot removed the Overdue label Jan 30, 2025
@chrispader
Copy link
Contributor

Asking for confirmation if this issue will be fixed as part of #53493.

Sorry for the delay! Yes this should get fixed by the modal screen migration, as we will remove the modal (react-native-modal) entirely.

@jjcoffee
Copy link
Contributor

Thanks!

@MitchExpensify I think we should hold on #53493, then we can retest once that's done.

Copy link

melvin-bot bot commented Feb 1, 2025

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@MitchExpensify
Copy link
Contributor

@MitchExpensify I think we should hold on #53493, then we can retest once that's done.

Sounds good @jjcoffee !

@MitchExpensify MitchExpensify changed the title [$250] [ iOS 17.2] App closes when back button pressed on PDF preview [HOLD on #53493] [$250] [ iOS 17.2] App closes when back button pressed on PDF preview Feb 2, 2025
@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2025
Copy link

melvin-bot bot commented Feb 6, 2025

@jjcoffee, @MitchExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@chrispader
Copy link
Contributor

There is a PR for this up now: #56219

Copy link

melvin-bot bot commented Feb 10, 2025

@jjcoffee, @MitchExpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@MitchExpensify
Copy link
Contributor

Not overdue, melvin

@melvin-bot melvin-bot bot removed the Overdue label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Needs Reproduction Reproducible steps needed
Projects
None yet
Development

No branches or pull requests

7 participants