Skip to content

Reports - Central panel changes from Submit tab to Expense tab when refreshing split RHP #81981

Closed

Description

@jponikarchuk

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: v9.3.16-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #79897
Email or phone of affected tester (no customers): expensify416+da2@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: macOS chrome
App Component: Search

Action Performed:

  1. Create a workspace.
  2. Create an expense in the workspace.
  3. Go to Reports > Submit (do not go to Expenses tab).
  4. Click on the expense
  5. Click More dropdown button > Split.
  6. Refresh the page.

Expected Result:

Reports > Submit tab should be displayed in the background

Actual Result:

Reports > Expenses tab is displayed on the background

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Activity

  1. imadirtydog commented on Feb 11, 2026

    @imadirtydog

    Proposal

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

    When a user is on the Search > Submit tab, clicks on an expense, clicks "Split" from the
    More dropdown, and then refreshes the page, the background tab switches to Expenses
    instead of staying on the Submit tab.

    What is the root cause of that problem?

    When refreshing the split expense page, the app reconstructs navigation state from the
    URL. The function getSearchParamFromPath() extracts the q parameter to determine
    which search tab to display:

    App/src/libs/Url.ts

    Lines 114 to 129 in ef6d827

    // Fallback: extract params from encoded backTo segment (e.g., ".../search/<encoded>/amount")
    const encodedBackToMatch = pathWithoutHash.match(/\/search\/([^/]+)/);
    const encodedBackTo = encodedBackToMatch?.[1];
    if (!encodedBackTo) {
    return null;
    }
    const decodedBackTo = safeDecode(encodedBackTo);
    const backToQueryIndex = decodedBackTo.indexOf('?');
    if (backToQueryIndex === -1) {
    return null;
    }
    const backToQueryString = decodedBackTo.slice(backToQueryIndex + 1);
    return getParamFromQueryString(backToQueryString);
    }

    The split expense URL contains a backTo path segment that, when decoded, reveals
    another URL with its own backTo query parameter. The actual search query
    (q=...action:submit...) is nested inside this second backTo.

    The current code only decodes one level deep - it finds backTo=... but doesn't look
    inside it for the q parameter. Without finding q, the code defaults to showing the
    Expenses tab.

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

    Modify getSearchParamFromPath() in src/libs/Url.ts to check for nested backTo
    parameters when the requested parameter isn't found at the first level:

    const backToQueryString = decodedBackTo.slice(backToQueryIndex + 1);                     
    const directResult = getParamFromQueryString(backToQueryString);                         
    if (directResult !== null) {                                                             
        return directResult;                                                                 
    }                                                                                        
                                                                                             
    // If param not found directly, check for nested backTo parameters                       
    const nestedBackToMatch = backToQueryString.match(/(?:^|&)backTo=([^&]*)/);              
    const nestedBackToValue = nestedBackToMatch?.[1];                                        
    if (nestedBackToValue) {                                                                 
        const decodedNestedBackTo = safeDecode(safeDecode(nestedBackToValue));               
        const nestedQueryIndex = decodedNestedBackTo.indexOf('?');                           
        if (nestedQueryIndex !== -1) {                                                       
            const nestedQueryString = decodedNestedBackTo.slice(nestedQueryIndex + 1);       
            return getParamFromQueryString(nestedQueryString);                               
        }                                                                                    
    }                                                                                        
                                                                                             
    return null;  
  2. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    Still overdue 6 days?! Let's take care of this!

  3. melvin-bot commented on May 4, 2026

    @melvin-bot

    @jponikarchuk, this Monthly task hasn't been acted upon in 6 weeks; closing.

    If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions