Skip to content

[$250] Android - Workspace - App crashes when tapping on workspace share link as other user #55195

Closed

Description

@IuliiaHerets

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: 9.0.84-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): Samsung Galaxy Z Fold 4 / Android 14
Issue reported by: Applause Internal Team
Device used: applausetester+100106kh@applause.expensifail.com
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Workspace profile.
  3. Tap Share.
  4. Tap Copy URL.
  5. Launch ND or hybrid app.
  6. Open any chat.
  7. Paste the link and remove staging from the link.
  8. Send the message.
  9. Tap on the link.

Expected Result:

App will not crash.

Actual Result:

App crashes.
When tapping on the link for the second time, it does not crash anymore.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6713710_1736843501983.Screen_Recording_20250114_153950_Device_care.1.mp4

Bug6713710_1736840668489!log.txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021882738607321830606
  • Upwork Job ID: 1882738607321830606
  • Last Price Increase: 2025-03-07
Issue OwnerCurrent Issue Owner: @laurenreidexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 14, 2025
  2. melvin-bot commented on Jan 14, 2025

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (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.

  3. laurenreidexpensify commented on Jan 16, 2025

    @laurenreidexpensify
    Contributor

    @IuliiaHerets can you confirm that this issue is reproducible on prod? I see two steps in the link that are staging specific -

    Go to staging.new.expensify.com
    Paste the link and remove staging from the link.

    If this is a staging specific issue and not relevant to prod we can close. Thanks

  4. BartoszGrajdek commented on Jan 17, 2025

    @BartoszGrajdek
    Contributor

    I'll triage this issue today! 👀

  5. NJ-2020 commented on Jan 18, 2025

    @NJ-2020
    Contributor

    Proposal

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

    Android - Workspace - App crashes when tapping on workspace share link as other user

    What is the root cause of that problem?

    When we click the link inside the report action, the openLink function got invoked

    <AnchorForCommentsOnly
    href={attrHref}
    // Unless otherwise specified open all links in
    // a new window. On Desktop this means that we will
    // skip the default Save As... download prompt
    // and defer to whatever browser the user has.
    // eslint-disable-next-line react/jsx-props-no-multi-spaces
    target={htmlAttribs.target || '_blank'}
    rel={htmlAttribs.rel || 'noopener noreferrer'}
    style={[style, parentStyle, textDecorationLineStyle, styles.textUnderlinePositionUnder, styles.textDecorationSkipInkNone]}
    key={key}
    // Only pass the press handler for internal links. For public links or whitelisted internal links fallback to default link handling
    onPress={internalNewExpensifyPath || internalExpensifyPath ? () => Link.openLink(attrHref, environmentURL, isAttachment) : undefined}

    and we navigate to that route if the it's internal new Expensify path and has the same origin
    if (internalNewExpensifyPath && hasSameOrigin) {
    if (Session.isAnonymousUser() && !Session.canAnonymousUserAccessRoute(internalNewExpensifyPath)) {
    Session.signOutAndRedirectToSignIn();
    return;
    }
    Navigation.navigate(internalNewExpensifyPath as Route);

    And it will navigate to WorkspaceJoinUserPage.tsx page, and navigateAfterJoinRequest will got invoked after the user has been invited to the workspace
    MemberAction.inviteMemberToWorkspace(policyID, inviterEmail);
    isJoinLinkUsed = true;
    Navigation.isNavigationReady().then(() => {
    if (isUnmounted.current) {
    return;
    }
    navigateAfterJoinRequest();

    And inside navigateAfterJoinRequest function we navigate to settings > workspace_settings
    const navigateAfterJoinRequest = () => {
    Navigation.goBack(undefined, false, true);
    Navigation.navigate(ROUTES.SETTINGS);
    Navigation.navigate(ROUTES.SETTINGS_WORKSPACES);
    };

    The root cause that causing this issue is that we're trying to perform multiple navigations in almost at the same time that causing the app to crash/exits, and also this issue only occurring in Android native only, this issue is not reproducible in IOS native, mWeb, web and desktop

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

    We need to wait until the navigation transitions complete first, we can wrap the navigateAfterJoinRequest with runAfterInteractions to ensure the interaction queue is idle

     Navigation.isNavigationReady().then(() => { 
         if (isUnmounted.current) { 
             return; 
         } 
         InteractionManager.runAfterInteractions(() => {
             navigateAfterJoinRequest(); 
         });
    })

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

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. github-actions commented on Jan 18, 2025

    @github-actions
    Contributor

    ⚠️ @NJ-2020 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  7. melvin-bot commented on Jan 20, 2025

    @melvin-bot

    @laurenreidexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  8. BartoszGrajdek commented on Jan 20, 2025

    @BartoszGrajdek
    Contributor

    I'll triage this issue today! 👀

    I didn't manage to find the time for it in the end, but from the proposal above it seems like it's not a live markdown related issue, so it's fine 👍🏻

  9. NJ-2020 commented on Jan 20, 2025

    @NJ-2020
    Contributor

    @BartoszGrajdek Hi, I just do more investigation on this issue and seems this issue caused by this PR, here's demo when using version before this PR is merged

    Screen.Recording.2025-01-19.at.12.54.37.mov

    And seems the issue is coming from react-native-screens, here's the error log when the app is crash:

    SurfaceMountingManager: Unhandled SoftException
    
    SurfaceMountingManager: java.lang.IllegalStateException: addViewAt: cannot insert view [3620] into parent [3622]: View already has a parent: [3626]  Parent: Screen View: ReactViewGroup
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SourceFile:139)
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(SourceFile:248)
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(SourceFile:54)
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(SourceFile:46)
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(SourceFile:35)
    
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(SourceFile:95)
    
    SurfaceMountingManager: 	at com.facebook.react.fabric.GuardedFrameCallback.doFrame(SourceFile:1)
    
    SurfaceMountingManager: 	at com.facebook.react.modules.core.ReactChoreographer.frameCallback$lambda$1(SourceFile:37)
    
    SurfaceMountingManager: 	at com.facebook.react.modules.core.ReactChoreographer.a(SourceFile:1)
    
    SurfaceMountingManager: 	at com.facebook.react.modules.core.a.doFrame(SourceFile:26)
    
    SurfaceMountingManager: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229)
    
    SurfaceMountingManager: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
    
    SurfaceMountingManager: 	at android.view.Choreographer.doCallbacks(Choreographer.java:899)
    
    SurfaceMountingManager: 	at android.view.Choreographer.doFrame(Choreographer.java:827)
    
    SurfaceMountingManager: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
    
    
    SurfaceMountingManager: 	at android.os.Handler.handleCallback(Handler.java:942)
    
    SurfaceMountingManager: 	at android.os.Handler.dispatchMessage(Handler.java:99)
    
    SurfaceMountingManager: 	at android.os.Looper.loopOnce(Looper.java:201)
    
    SurfaceMountingManager: 	at android.os.Looper.loop(Looper.java:288)
    
    SurfaceMountingManager: 	at android.app.ActivityThread.main(ActivityThread.java:7924)
    
    SurfaceMountingManager: 	at java.lang.reflect.Method.invoke(Native Method)
    
    SurfaceMountingManager: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    
    SurfaceMountingManager: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

    I think the error is coming specifically from this file and this file

    And also I've opened an issue in react-native-screens here

  10. BartoszGrajdek commented on Jan 20, 2025

    @BartoszGrajdek
    Contributor

    I'm react-native-live-markdown maintainer, not an internal/C+ so you don't need to worry about me 😄 @NJ-2020

    This issue was initially sent to us as a possible react-native-live-markdown bug, but since that's not the case I'm no longer needed here 👍🏻

  11. 94 remaining items

  12. NJ-2020 commented on Mar 10, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify Actually this issue has been fixed by @tomekzaw just for suffice but we haven't find the right root cause yet for this issue, more details here, so it's not reproducible anymore

    But this issue still reproducible on the latest main on dev, but you need to override some node_modules content, more info here

    Screen.Recording.2025-03-10.at.20.43.21.mov

    Right now I am waiting an update from @tomekzaw

  13. tomekzaw commented on Mar 13, 2025

    @tomekzaw
    Contributor

    @NJ-2020 There's way too many comments with different repro cases in this discussion.

    I have tested the app today and it doesn't crash for me, no matter if I leave the link untouched, remove dev. or add staging. in the URL.

    Can you please provide repro steps for current main as well as provide some stack traces so I can see the actual error?

    Maybe we should close this issue now (since the original crash has already been fixed) and submit another issue where we can discuss more easily?

  14. NJ-2020 commented on Mar 13, 2025

    @NJ-2020
    Contributor

    @tomekzaw Okay then if you want to create new issue so we can discuss more easier then it's ok, and also I'll post a proposal including all the required information i.e stacktraces, error logs, reproduction steps, before/after results, etc

    Wdyt? If yes, then we can ask @laurenreidexpensify to close this and create new one


    And also to reproduce this issue could you please check this

  15. NJ-2020 commented on Mar 13, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify Could you please create new issue based on this and close this one? Thanks

  16. laurenreidexpensify commented on Mar 13, 2025

    @laurenreidexpensify
    Contributor

    @NJ-2020 can you request a new bug write up in #expensify-bugs in slack thanks

  17. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Mar 13, 2025
  18. NJ-2020 commented on Mar 13, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify Sorry, I do not have permissions to #expensify-bugs slack channel

  19. NJ-2020 commented on Mar 13, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify Could you please create one if you don't mind?

  20. NJ-2020 commented on Mar 16, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify or @Ollyws maybe, could you please create new issue, since I do not have any access/permissions to #expensify-bugs slack channel or creating new issue on GH

    Thanks

  21. NJ-2020 commented on Mar 21, 2025

    @NJ-2020
    Contributor

    @laurenreidexpensify Bump for above ^

  22. NJ-2020 commented on Mar 27, 2025

    @NJ-2020
    Contributor

    @Ollyws Can you create a new issue or request new bug inside #expensify-bugs slack channel

  23. NJ-2020 commented on Apr 10, 2025

    @NJ-2020
    Contributor

    Hi guys could you please create new issue for above ^^ please

    I just want to clarify that I have put many time of efforts for this issue debugging the react-native-live-markdown (C++ & Java)

    And actually we already fixed the issue but it's like a workaround solution as mentioned by @tomekzaw, we haven't found the root cause yet and good solution for it

    And here's my new proposal, but I will update it later in the new issue

    I'd like to hear your thoughts @Ollyws @laurenreidexpensify

    Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions