Filters and Search Now Reset When Switching Status in Batch Mails and Documents
Executive summary
Grids in the Batch Mails and Batch Documents views now automatically clear their column filters, search terms, and pagination when the user switches between statuses or document types. This prevents filters from one status from incorrectly carrying over and hiding records under another status.
Why this was needed
Previously, when a user applied a filter or search within one status (for example, filtering mails by a sender) and then switched to a different status, those filters and the current page position persisted. This produced misleading or empty result sets, because filters meaningful for one status were silently applied to another. The fix addresses tracked issue DA-37 ("Filter being carried forward across status in Batch Mails / Batch Documents").
Client / user impact
Users navigating between statuses or document types in the Batch Mails and Batch Documents grids now always start from a clean, unfiltered view at the first page. This removes confusion from stale filters and prevents the appearance of "missing" records that were actually being filtered out by a carried-over filter.
Technical scope
Frontend-only change (Next.js, 4 files, +22/-0), promoted to the QA environment. Each affected grid gains a useEffect that resets state when the active status (or document type) identifier changes:
src/components/batches/TabContents/MailContents/MailContents.tsx: clears column filters, resets page number to 1, and clears both the search term and its debounced value onselectedStatus?.idchange (combines feature PR #349).src/components/common/data-grid.tsx: shared grid now clears active filters and column filters whenstatusIdchanges.src/components/documents/batches/DocumentGrid.tsx: clears column filters and resets page index to the first page onstatus?.idchange (combines feature PR #350)..gitignore: addsai_docsto exclude local project documentation from version control (chore, no runtime effect).
Risk & mitigation
Low risk. Changes are additive, scoped to client-side grid state, and use established React effect patterns keyed on the status identifier. The main behavioral consideration is that any deliberate filter or search is intentionally discarded on status switch by design; this is the expected fix. Mitigation: verify the resets fire only on status/type change and not on unrelated re-renders (e.g., incoming data updates) that could wipe an active filter mid-session.
QA validation focus
- In Batch Mails: apply a column filter and a search term under one status, switch to another status, and confirm filters, search box, and page all reset to a clean first-page view.
- In Batch Documents: filter and page deep into one document type/status, switch to another, and confirm column filters clear and the grid returns to page one.
- Confirm switching back to the original status starts clean rather than restoring the prior filter.
- Regression: verify that refreshing data within the same status (no status change) does not unexpectedly clear an active filter or search, and that pagination within a single status still works normally.