📌 Description
SettlementsPanel's handleExport (src/components/SettlementsPanel.tsx) calls exportSettlementsCsv({ pageSize }), passing only the current page size and no page. exportSettlementsCsv (src/lib/settlementsApi.ts) defaults to the server's page-1 behavior whenever page is omitted. If a user has clicked "Load more" one or more times — which appends additional pages of settlements into the on-screen table via loadMore() — clicking "Export CSV" afterward still only downloads the FIRST pageSize rows from the server, not the full set of rows currently visible in the table. A user who has scrolled through, say, 120 loaded settlements across several "Load more" clicks and exports a CSV gets a file containing only the first 10–50, with no indication anything was left out.
🧩 Requirements and context
handleExport should export a CSV that covers (at minimum) all settlements currently loaded into the panel via "Load more", not just the first page.
- If the backend's CSV endpoint has no way to request "all currently-loaded pages" in one call, either loop
exportSettlementsCsv across the loaded page range and concatenate, or clearly communicate in the UI (e.g. via the button's label/tooltip, or a toast) that the export is scoped to the first page only — do not leave the current silent mismatch as-is.
- Preserve the existing
exporting button-disabled state and success/failure toast behavior.
🛠️ Suggested execution
- Track how many pages have been loaded (derivable from
state.pagination.page at export time) and update handleExport in src/components/SettlementsPanel.tsx to request that many pages' worth of CSV data (e.g. sequential exportSettlementsCsv({ page, pageSize }) calls concatenated, skipping the repeated CSV header on subsequent pages), or take the "clearly communicate the limitation" fallback if a bulk-export endpoint isn't feasible in scope.
- Extend
src/components/SettlementsPanel.test.tsx and src/lib/settlementsApi.test.ts to assert the export reflects all loaded pages (or clearly documents the chosen scope) after one or more "Load more" clicks.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; the export reuses the backend's existing read-only CSV endpoint.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
SettlementsPanel'shandleExport(src/components/SettlementsPanel.tsx) callsexportSettlementsCsv({ pageSize }), passing only the current page size and nopage.exportSettlementsCsv(src/lib/settlementsApi.ts) defaults to the server's page-1 behavior wheneverpageis omitted. If a user has clicked "Load more" one or more times — which appends additional pages of settlements into the on-screen table vialoadMore()— clicking "Export CSV" afterward still only downloads the FIRSTpageSizerows from the server, not the full set of rows currently visible in the table. A user who has scrolled through, say, 120 loaded settlements across several "Load more" clicks and exports a CSV gets a file containing only the first 10–50, with no indication anything was left out.🧩 Requirements and context
handleExportshould export a CSV that covers (at minimum) all settlements currently loaded into the panel via "Load more", not just the first page.exportSettlementsCsvacross the loaded page range and concatenate, or clearly communicate in the UI (e.g. via the button's label/tooltip, or a toast) that the export is scoped to the first page only — do not leave the current silent mismatch as-is.exportingbutton-disabled state and success/failure toast behavior.🛠️ Suggested execution
state.pagination.pageat export time) and updatehandleExportinsrc/components/SettlementsPanel.tsxto request that many pages' worth of CSV data (e.g. sequentialexportSettlementsCsv({ page, pageSize })calls concatenated, skipping the repeated CSV header on subsequent pages), or take the "clearly communicate the limitation" fallback if a bulk-export endpoint isn't feasible in scope.src/components/SettlementsPanel.test.tsxandsrc/lib/settlementsApi.test.tsto assert the export reflects all loaded pages (or clearly documents the chosen scope) after one or more "Load more" clicks.✅ Acceptance criteria
🔒 Security notes
No new attack surface; the export reuses the backend's existing read-only CSV endpoint.
📋 Guidelines