Skip to content

Filter history: order list integration - #16422

Open
AdamGrzybkowski wants to merge 3 commits into
issue/WOOMOB-3825-filter-history-screenfrom
issue/WOOMOB-3826-order-list-integration
Open

Filter history: order list integration#16422
AdamGrzybkowski wants to merge 3 commits into
issue/WOOMOB-3825-filter-history-screenfrom
issue/WOOMOB-3826-order-list-integration

Conversation

@AdamGrzybkowski

Copy link
Copy Markdown
Contributor

Part of WOOMOB-3326WOOMOB-3826

Description

Third PR in the filter history stack: wires the shared history screen (#16421) into the order list filters. Behind the FILTER_HISTORY flag.

  • Adds a flag-gated clock entry point to the order filter screen → opens the history screen with source=orders and tracks filter_history_button_tapped.
  • Saves the current selection to history when the user taps Show Orders — from either the categories screen or an options sub-screen — via a new SaveOrderFilterToHistory use case that reads the full selection from OrderFiltersRepository (the source of truth) and runs fire-and-forget on the app scope, so navigation isn't blocked and a rare failure can't crash the app.
  • Applies a picked past filter by writing the decoded selection (per category + custom date range) back to the repository and rebuilding the categories, reusing the existing persistence→UI round-trip (so filters whose values no longer exist are silently dropped).
  • OrderFilterHistoryMapper produces a canonical JSON payload (stable dedup) and a readable label.

Test Steps

Enable Filter History in the developer feature-flag screen, then on the Orders tab:

  • Open Filters → tap the clock (top right) → confirm the history is empty.
  • Select some filters → Show Orders → reopen the history → the filter appears at the top.
  • Apply more filters and confirm newest-first + dedup; swipe to delete one; tap a past filter and confirm the filter screen repopulates and Show Orders lists correctly; Clear History → confirm dialog → empty state.
  • Verify Tracks events fire with source=orders.

Stacked PRs

PR 3 of 4. Base branch: issue/WOOMOB-3825-filter-history-screen (#16421).

  • I have considered if this change warrants release notes — none needed (behind feature flag, not user-facing).

@wpmobilebot

wpmobilebot commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Build Number778
Version25.4-rc-1
Application IDcom.woocommerce.android.prealpha
Commit18e4762
Installation URL5j0lm9l7tk9p8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@AdamGrzybkowski
AdamGrzybkowski force-pushed the issue/WOOMOB-3826-order-list-integration branch from cf50664 to 87091f0 Compare August 14, 2026 14:49

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review - Found 1 potential issue

The feature is well structured: the shared FilterHistoryRepository/FilterHistoryViewModel are reused cleanly, the payload encoding is canonicalized for reliable dedup, the save runs fire-and-forget on the app scope with failures swallowed, and the test coverage (mapper round-trip, save use case, both ViewModels) is thorough. One correctness issue on the custom-date-range round-trip is called out inline.

PR housekeeping
  • Applied repo AGENTS.md/CLAUDE.md guidance: store-app MVVM patterns (ScopedViewModel, triggerEvent/MultiLiveEvent, repository-mediated data access) are followed correctly.

Automatic review · claude-opus-4-8 · Workflow run

How to reply to a finding

Reply on this review (or inline at the line the finding refers to) with one of:

  • @claude addressed - I made the change. Bot verifies against the next diff before marking resolved.
  • @claude rejected: <reason> - Will not fix; reason gets quoted on the next review.
  • @claude not-applicable - Finding does not apply (wrong file, already covered elsewhere, etc.).

The bot honours these on the next review pass.

category.orderFilterOptions.any { it.isSelected && it.key != DEFAULT_ALL_KEY }
}
if (!hasSelection) return
val customDateRange = orderFiltersRepository.getCustomDateRangeFilter()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review [fix here]

Issue: Custom date range is saved in the wrong unit. getCustomDateRangeFilter() returns the range converted to milliseconds (startDay.toDateAtStartOfDay().time), and that value is stored in the payload as customDateRangeStart/customDateRangeEnd. On restore, OrderFilterCategoriesViewModel.onPastFilterSelected() passes those numbers straight into orderFilterRepository.setCustomDateRange(...), which expects epoch days (same contract as the picker: OrderFilterOptionsViewModel.onCustomDateRangeChanged(startDay, endDay)setCustomDateRange). Applying a saved filter that has a custom date range therefore writes a millis value into the days pref, yielding a corrupted, far-future range. The existing tests don't catch this because both sides are mocked.

Suggestion: Store epoch days in the payload so the round-trip matches setCustomDateRange. Use getCustomDateRangeDays() instead of getCustomDateRangeFilter() here:

val customDateRange = orderFiltersRepository.getCustomDateRangeDays()

Consider adding a round-trip test that goes through the real OrderFiltersRepository (not a mock) to lock the units down.

@AdamGrzybkowski AdamGrzybkowski added status: feature-flagged Behind a feature flag. Milestone is not strongly held. New Feature labels Aug 14, 2026
@AdamGrzybkowski
AdamGrzybkowski force-pushed the issue/WOOMOB-3826-order-list-integration branch 3 times, most recently from 71ec830 to ed405c6 Compare August 14, 2026 15:14
Adds a flag-gated clock entry point on the order filter screens, saves the current selection to history on Show Orders (via SaveOrderFilterToHistory on the app scope), and applies a picked past filter. Part 3 of WOOMOB-3326 (WOOMOB-3826).
@AdamGrzybkowski
AdamGrzybkowski force-pushed the issue/WOOMOB-3826-order-list-integration branch from ed405c6 to 19457e2 Compare August 14, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Feature status: feature-flagged Behind a feature flag. Milestone is not strongly held.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants