All updates
ProductionQAFrontend

Mail Editing Safeguards, Viewer Stability, and Consistent Search Responsiveness (QA)

PR #599heytulsiprasadOct 14, 2025 · 18:00 UTC
QAOct 14, 2025
ProductionOct 14, 2025

Executive summary

This QA batch bundles several mail and document workspace improvements. It adds an unsaved-changes warning so users no longer lose in-progress mail edits when switching status, fixes document/PDF visibility when moving between tabs in the mail viewer, standardizes search responsiveness across the app, and corrects pagination centering on mobile. It also includes internal code-quality refactors that carry no user-facing behavior change.

Why this was needed

Users editing mail details could silently lose their changes if they changed the status mid-edit, and the document preview panel sometimes lost its layout or content when navigating between the Overview, Documents, Activity, and Resolution tabs. Search inputs across grids and selectors used inconsistent delays (300/350/500/600ms), causing uneven responsiveness. On mobile, pagination controls were misaligned, and certain client/subclient lookups were over-fetching paginated data they did not need.

Client / user impact

  • Editing mail details is safer: changing status while you have unsaved edits now prompts a confirmation dialog before discarding them.
  • The mail viewer reliably keeps document/PDF content and panel layout when switching tabs.
  • Search feels uniform everywhere because all inputs now share one debounce delay.
  • Pagination controls are centered and readable on small screens.
  • Workspace owner and client/subclient selectors return the correct, complete set of options.

Technical scope

  • Unsaved-changes guard (PR #592): New UnsavedChangesDialog component, useUnsavedChangesGuard hook, and a Zustand unsaved-changes.store track edit state globally. Status changes on the mail detail page are intercepted via handleStatusSelection and confirmed before discarding edits.
  • Mail viewer refactor / PDF visibility fix (PR #593): Extracted useMailViewerLayout, useMailFileSelection, and usePdfViewerPrefetch hooks (new src/hooks/use-mail-viewer.ts); added forceMount to all TabsContent so tab content (incl. PDF) is no longer unmounted; centralized layout constants.
  • Centralized debounce (PR #590): New GLOBAL_DEBOUNCE_DELAY_MS constant replaces scattered 300/350/500/600ms literals across ~25 grids, selectors, and search inputs.
  • Client lookup pagination toggle (PR #596): getSubClientsByClientId / useGetSubClientsByClientId gain an enable_pagination option to disable backend pagination for the mail-details client lookup.
  • Workspace owner selector (PR #594): Adjusts client service so API clients are included in the owner selector.
  • Mobile pagination centering (PR #595): DataGrid pagination now centers on small viewports with lg:-prefixed alignment classes.
  • Type-safety refactors (PR #598 + others): Removed @typescript-eslint/no-explicit-any suppressions in mail detail pages and ClassificationAndRouting; introduced typed Status3 / module-status shapes.

Risk & mitigation

Moderate. The mail detail pages were substantially refactored (state moved into shared hooks and a global store), so regressions could surface in tab switching, panel persistence, or status updates. The forceMount change keeps all tabs mounted, slightly increasing memory use. The global debounce change touches many search surfaces. Mitigation: changes are isolated to the frontend and confined to QA; behavior is largely preserved by reusing existing logic inside the new hooks.

QA validation focus

  • Edit mail details, then change status without saving: confirm the warning dialog appears and Cancel/Confirm behave correctly.
  • Switch between Overview, Documents, Activity, and Resolution tabs: confirm PDF/document content and panel layout persist; double-click divider restores balanced layout.
  • Verify search/typing in grids, column filters, folder/document-type sidebars, and async selectors feels responsive and consistent.
  • Check pagination controls are centered on mobile and left-aligned on desktop.
  • Confirm workspace owner selector lists API clients, and client/subclient dropdowns on mail details return the full expected set.