feat(datagrid-web): add onBeforeExport and onAfterExport event actions - #2392
feat(datagrid-web): add onBeforeExport and onAfterExport event actions#2392r0b1n wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
e1fc392 to
5134ce1
Compare
This comment has been minimized.
This comment has been minimized.
| ); | ||
| }, [columnsStore.visibleColumns, entry]); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
i felt like this is an antipattern of synchronizing props from useExportData to ExportController.
we already have NanoEvent style of communicatings between events.
and DSExportRequest is emitting loadstart and loadend.
can we subscribe to this somewhere?
seems not quite right to break the nanoevents pattern and sync using useEffect for this.
Am I wrong?
- Narrow AfterExportArgs.status to "success" | "aborted" union type - Move onBeforeExport callback before handler(req) to match spec ordering - Update openspec artifacts to replace filterCondition with fileName/sheetName and document the intentional removal of filterCondition
5134ce1 to
5bace00
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI: Several checks (sigridci, Run code quality check, Plan E2E matrix, AI Code Review) were still IN_PROGRESS at review time. The completed checks (triage, Check SHA in GH Actions, Read versions file, Snyk code/license/security) all show SUCCESS. Confirm all checks are green before merging. Findings
|
Summary
onBeforeExportfires fire-and-forget immediately before the first datasource page fetch; receivesgridName,columnTitles,chunkSize,fileName,sheetName, andstartTimeonAfterExportfires after the export resolves (success or abort); additionally receivesexportedItemCount,status("success"|"aborted"), andendTimefileNameandsheetNameare passed by the external export caller viaexportData()options and default to empty strings when not providedChanges
Datagrid.xml— two new<property type="action">blocks with<actionVariables>in the Events groupDatagridProps.d.ts— updated manually to match XML (will be regenerated on build)DSExportRequest.ts— exposedget loaded()andget limit()public getters (renamed private fields to_loaded/_limit)ExportController.ts— addedBeforeExportArgs/AfterExportArgstypes;nameconstructor param;beforeexport/afterexportevents inControllerEvents; publicon()method (returnsUnsubscribe); emits both events inexportData()useDataExport.ts— stores latestActionValueprops in refs; subscribes tobeforeexport/afterexportonce per controller lifetime viauseEffect([entry]); effect cleanup unsubscribes automaticallyExportController.spec.ts— 5 new unit tests covering all event scenariosTest plan
pnpm run test)onBeforeExportandonAfterExporton a Data Grid 2, trigger an export, verify both microflows/nanoflows are called with correct variable valuesstatusis"aborted"when the user cancels mid-export