Document Upload Editing Safeguards, Bulk Document Download, and Grid/UI Polish (QA)
Executive summary
This QA batch bundles several frontend improvements centered on the document-upload workflow and mail document handling. Users editing a PDF's document segments can now cancel and roll back their changes, document-type dropdowns load faster with searchable pagination, mail details gains a one-click bulk download for all documents, and long text across batch grids is consistently truncated with hover tooltips. A branded 404 page and an Add Mail form fix (a selectable "None" option for Client/Subclient) are also included.
Why this was needed
Several rough edges had accumulated in the document and batch experiences. While splitting a PDF into document segments, users had no safe way to abandon in-progress edits, risking accidental changes. Document-type dropdowns fetched up to 50 items at once, slowing the first open. Downloading all documents on a mail required repetitive per-file actions. Long values in batch grids overflowed without a way to read the full text, and the Add Mail form offered no way to clear an already-chosen Client or Subclient. There was also no branded experience for unknown URLs.
Client / user impact
- Operators editing document segments can press "Cancel Changes" to discard interim edits and restore the prior state, reducing data-entry mistakes.
- Document-type pickers open faster (smaller initial page) and support type-ahead search plus load-more for large catalogs.
- Mail Details adds a bulk "Download" action that packages all of a mail's documents in one request.
- Batch grid cells truncate long strings with a tooltip showing the full value, improving readability.
- Add Mail lets users explicitly select "None" to clear Client/Subclient.
- Visiting an unknown URL now shows a branded 404 page with a "Return to inbox" link.
Technical scope
Grounded in the diff (~724 add / 134 del across 19 files), bundling feature PRs #658, #659, #661, #662, #663:
- Document upload (
document-upload/): NewcreateSnapshot/restoreSnapshotinuseDocumentSegmentsStorewith deep-cloned segments; page captures pre-edit and committed snapshots so Cancel rolls back. Button relabeled "Cancel Changes". - Document-type options (
useDocumentTypeOptions): Initial page size cut from 50 to 10; added a cached, de-duplicatedsearchDocumentTypes(query,page,limit)async loader wired intoMultipleSelectorviaonPaginatedSearch. - Segments grid: Skeleton
ScrollSeekPlaceholderand tuned virtualization padding for fast scrolls; "Add Range" hidden while segments/PDF context are still loading; gated ononLoadSuccess/onLoadError. - Bulk download: New route
/v1/downloads/documents/by-mail, servicebulkDownloadDocumentsByMail, anduseDownloadMailDocumentsMutation; wired intoMailDocumentsdownload button. - MailDocuments: Reworked "uncategorized" bucket to filter type-less docs client-side; dropped
unassignedCategoryIdlookup andinclude_columns/include_version_infoparams. - Batches grid:
MAX_TRUNCATED_CHARS_TO_SHOW=50constant;TruncatedTextapplied to string cells indata-grid.tsxandBatchContents/columns.tsx; tightened column typing. - MailForm: "None"
SelectItemclears Client/Subclient. - 404: New
not-found.tsx+ brandedNotFoundContent. - Batches documents page: Removed
useGetDocumentStatus/Completed-status fallback; documents fetch only when a status is selected. - Note: PR description also lists adminhub/Strapi fixes, but no such files appear in this diff.
Risk & mitigation
Medium. The snapshot save/cancel logic in document upload has many new effects and refs, so the main risk is stale or incorrectly restored state on cancel/save. The shared paginated-search cache could surface stale or mismatched dropdown pages if cache keys collide. The grid truncation change clones React elements and replaces string children, which could mis-render cells whose content is not a simple string. The batches-documents page now fetches only when a status is selected, changing default load behavior. Mitigation: deep clones isolate snapshot state, the cache is keyed by query+limit+page, and element cloning falls through to render-as-is for non-string children; QA should exercise these paths directly.
QA validation focus
- Document upload: enter edit mode, modify segments/ranges/notes, click "Cancel Changes" and confirm full rollback; save and confirm baseline updates; verify "Add Range" stays hidden until PDF/segments finish loading.
- Document-type dropdowns: confirm fast initial open, type-ahead search returns server results, and load-more works for large catalogs without duplicates.
- Mail Details: click bulk "Download", confirm all documents are packaged; verify error toast when mail id is missing.
- Uncategorized bucket: confirm only type-less documents appear and counts are correct.
- Batch grids: confirm long strings truncate with a working tooltip and short values render normally.
- Add Mail: select "None" for Client and Subclient and confirm selection clears.
- Navigate to an invalid URL and confirm the branded 404 with a working "Return to inbox" link.
- Batches > Documents tab: confirm documents load when a status is selected and the tab still behaves correctly with no status.