Skip to content

[$250] Reports - Unable to select date filter #86540

Closed

Description

@lanitochka17

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.3.50-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: https://test-management.browserstack.com/projects/2219752/test-runs/TR-13882/folder/13176922/44231135/1285943859?sort=-identifier
Email or phone of affected tester (no customers): snodijosdnjoijiosnj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Mac 26.2 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Reports > Expenses.
  3. Click Filters.
  4. Scroll down and click Withdrawn.
  5. Click On.
  6. Select a date, then click Save.

Expected Result:

The selected date will appear as subtitle below On title.

Actual Result:

The selected date does not appear as subtitle below On title. The date is not selected.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7114933_1774618508861.8.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @cretadn22
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022037529473436881136
  • Upwork Job ID: 2037529473436881136
  • Last Price Increase: 2026-03-27

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 27, 2026
  2. MelvinBot commented on Mar 27, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a user selects a date modifier (On/After/Before) in any date-based search filter, Navigation.navigate pushes a new screen instance onto the stack. This happens because linkTo (App/src/libs/Navigation/helpers/linkTo/index.ts:156-164) converts NAVIGATE to PUSH for these sub-page routes (they don't match any registered dynamic route suffix).

    The user picks a date on the calendar and clicks Save. DateFilterBase.save() (App/src/components/Search/FilterComponents/DateFilterBase.tsx:140-154) stores the date only in the pushed instance's local React state via setDateValueOfSelectedDateModifier(), then immediately navigates back — popping and destroying that instance. The original instance is revealed with its own independent state that never received the selected date. Crucially, onSubmit (which writes to Onyx) is intentionally skipped when selectedDateModifier is set, so the value is never persisted anywhere.

    This affects all date filters using SearchDatePresetFilterBasePage (date, submitted, approved, paid, exported, posted, withdrawn), not just Withdrawn.

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

    Two changes are needed:

    1. In SearchDatePresetFilterBasePage (App/src/components/Search/SearchDatePresetFilterBasePage.tsx): Pass onDateValuesChange to DateFilterBase that writes intermediate date values to Onyx via updateAdvancedFilters. The existing onDateValueChange callback in DatePresetFilterBase is already called synchronously inside setDateValue (which setDateValueOfSelectedDateModifier triggers), so the Onyx write will happen before the navigation/pop occurs.

    2. In DatePresetFilterBase (App/src/components/Search/FilterComponents/DatePresetFilterBase.tsx:83-89): Update the useEffect to also sync dateValues state when defaultDateValues changes (currently it only watches isSearchAdvancedFiltersFormLoading). This allows the original instance to pick up the Onyx values written by the pushed instance before it was popped. The individual date value strings (On/Before/After) should be used as dependencies rather than the object reference.

    What alternative solutions did you explore? (Optional)

    • Use local state instead of URL params for sub-page navigation: This would keep the same component instance (avoiding the push/pop problem entirely), but would break URL-based sub-page routing and the browser back button for these filter pages.
    • Register sub-page suffixes in DYNAMIC_ROUTES: This would make findMatchingDynamicSuffix return a match, keeping the action as NAVIGATE (params update in place). However, this would change the navigation pattern for all date filters and might have unintended side effects with browser history.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 27, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 27, 2026
  5. melvin-bot commented on Mar 27, 2026

    @melvin-bot

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

  6. changed the title [-]Reports - Unable to select date filter[/-] [+][$250] Reports - Unable to select date filter[/+] on Mar 27, 2026
  7. melvin-bot commented on Mar 27, 2026

    @melvin-bot
  8. trasnake87 commented on Mar 27, 2026

    @trasnake87
    Contributor

    Proposal

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

    When selecting a date modifier (On/After/Before) in any date-based search filter and picking a date from the calendar, the date is not persisted — it silently disappears after clicking Save.

    What is the root cause of that problem?

    In SearchDatePresetFilterBasePage, the selectDateModifier callback uses Navigation.navigate(buildSubPageRoute(...)) to switch between the modifier list and the calendar view. Because linkTo converts this NAVIGATE action into a PUSH, a new screen instance is mounted with its own fresh DatePresetFilterBase state. When the user picks a date and clicks Save, DateFilterBase.save() writes the date into that new instance's local state via setDateValueOfSelectedDateModifier(), then immediately calls setSelectedDateModifier(null) — which triggers Navigation.goBack(), popping and destroying the instance along with its state. The original instance underneath never received the date.

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

    Replace Navigation.navigate / Navigation.goBack in selectDateModifier with navigation.setParams so that toggling the subPage param updates the existing screen in-place instead of pushing a new one. This keeps a single component instance alive, preserving the DatePresetFilterBase local state across list ↔ calendar transitions. The header back button already works correctly via DateFilterBase.goBack().

    In src/components/Search/SearchDatePresetFilterBasePage.tsx:

    import {useNavigation, useRoute} from '@react-navigation/native';
    
    // inside the component:
    const navigation = useNavigation();
    
    const selectDateModifier = useCallback(
        (dateModifier: SearchDateModifier | null) => {
            const subPage = !dateModifier
                ? undefined
                : dateModifier === CONST.SEARCH.DATE_MODIFIERS.ON
                  ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON
                  : dateModifier === CONST.SEARCH.DATE_MODIFIERS.AFTER
                    ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER
                    : CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE;
            navigation.setParams({subPage});
        },
        [navigation],
    );

    This is a single-file fix. It avoids persisting intermediate/unsaved values to Onyx, keeps the component lifecycle simple, and the buildSubPageRoute helper + Navigation import for this callback become unused and can be removed.

    What alternative solutions did you explore?

    Persisting intermediate date values to Onyx via onDateValuesChange on every calendar interaction was considered, but that writes draft state to the store before the user has committed — setParams is simpler and avoids side effects.

  9. trasnake87 commented on Mar 27, 2026

    @trasnake87
    Contributor

    Contributor details
    Your Expensify account email: trasnake87@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656

  10. melvin-bot commented on Mar 27, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. MobileMage commented on Mar 27, 2026

    @MobileMage
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  12. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    ⚠️ @MobileMage Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  13. 20 remaining items

  14. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    ⚠️ @marufsharifi Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  15. marufsharifi commented on Mar 30, 2026

    @marufsharifi

    @cretadn22 I’ve submitted the proposal—could you please take a look? Thanks.

  16. marufsharifi commented on Mar 31, 2026

    @marufsharifi

    @cretadn22 gentle bump. thanks.

  17. cretadn22 commented on Mar 31, 2026

    @cretadn22
    Contributor

    @marufsharifi Your proposal is working great. Please create a PR to address this regression. Because Joel is OOO so I will review the PR as confirmed in this thread

  18. added
    ReviewingHas a PR in review
    and removed on Apr 1, 2026
  19. cretadn22 commented on Apr 2, 2026

    @cretadn22
    Contributor

    This feature was recently updated, and the bug is no longer reproducible

    Screen.Recording.2026-04-02.at.23.36.39.mov
  20. cretadn22 commented on Apr 3, 2026

    @cretadn22
    Contributor

    @mallenexpensify As noted in above comment, the bug is no longer reproducible on main. However, since I had already started, I’ve completed the proposal review and the PR review, including the full checklist and testing across all platforms. Could you please post the payment for me?

  21. cretadn22 commented on Apr 3, 2026

    @cretadn22
    Contributor

    Another note, this is regression from #83154, I’ve stepped in to finish the review and testing since Joel is OOO(confirmed in Slack)

  22. mallenexpensify commented on Apr 6, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @cretadn22 due $250 via NewDot

    (bit tricky but they took over to help and the PR was reviewed with tests completed so payout should be 100%)

  23. JmillsExpensify commented on Apr 15, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @cretadn22

  24. cretadn22 commented on Apr 26, 2026

    @cretadn22
    Contributor

    @wubing-wx I’m sorry, is there a misunderstanding? I don't know who you are?

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions