-
Notifications
You must be signed in to change notification settings - Fork 0
systems frontend workflow state
Douwe de Vries edited this page Jul 1, 2026
·
1 revision
Active contributors: Douwe de Vries
The frontend workflow state system coordinates the CSV file anonymization experience in React. It connects file selection, CSV analysis, column selection, preview, final output jobs, settings persistence, and Local AI readiness before any work crosses the Tauri command shell.
| Path | Role |
|---|---|
frontend/src/hooks/useAnonymizerWorkflow.ts |
Composes the CSV workflow hooks and returns the view model consumed by the workflow UI. |
frontend/src/hooks/useCsvAnalysis.ts |
Loads input files, computes default output paths, refreshes row counts, and stores last-used paths. |
frontend/src/hooks/useColumnSelection.ts |
Maintains selected column indexes, per-column controls, type overrides, strategy overrides, and visible-column slicing. |
frontend/src/hooks/usePreviewWorkflow.ts |
Runs preflight validation and preview generation for selected CSV columns. |
frontend/src/hooks/useAnonymizeJob.ts |
Starts, polls, finishes, and cancels retained anonymization jobs. |
frontend/src/hooks/usePersistentSettings.ts |
Loads, applies, saves, and reconciles persisted application settings. |
-
useAnonymizerWorkflowis the composition root for CSV file workflow state. -
BusyStateprevents overlapping actions such as picking, loading, previewing, and running output creation. -
ColumnControlcarries frontend type overrides and strategy overrides to backend commands. -
useCsvAnalysisowns input and output path state, then updates settings whenrememberLastPathsis enabled. -
usePreviewWorkflowcalls backend preflight first, then requests preview samples only when readiness is acceptable. -
useAnonymizeJobstores the active job ID, pollsget_anonymize_job_status, and applies completedAnonymizeData. -
usePersistentSettingskeeps an authoritative settings ref so stale save responses do not overwrite newer edits.
sequenceDiagram
participant View as Workflow view
participant Workflow as useAnonymizerWorkflow
participant Analysis as useCsvAnalysis
participant Preview as usePreviewWorkflow
participant Job as useAnonymizeJob
participant Tauri as frontend/src/tauri.ts
View->>Workflow: user picks or enters input
Workflow->>Analysis: handlePickInput or maybeLoadManualPath
Analysis->>Tauri: analyzeCsv()
Tauri-->>Analysis: headers, selected columns, output suggestion
View->>Workflow: edit columns and strategies
Workflow->>Preview: previewCsv()
Preview->>Tauri: preflightAnonymization()
Preview->>Tauri: previewAnonymization()
Tauri-->>Preview: PreviewData
View->>Workflow: create output
Workflow->>Job: runAnonymization()
Job->>Tauri: startAnonymizeJob()
loop until terminal
Job->>Tauri: getAnonymizeJobStatus()
end
Tauri-->>Job: AnonymizeData or failure
Analysis clears stale preview and result artifacts whenever input, output, settings, or column controls affect backend output. Preview and final output share the same selected columns and controls, but final output also passes cached Smart replacement preview entries so the backend can reuse accepted Local AI replacements when they cover selected values.
-
frontend/src/tauri.tsmaps hook calls to command names registered by Tauri command shell. -
frontend/src/types.tsmirrorscrates/csv-anonymizer-core/src/types.rs, includingColumnMetadata,ColumnControl,PreviewData,AnonymizeData, andPrivacyReport. - Local AI readiness comes from
frontend/src/hooks/useLocalAi.tsand blocks preview or output when selected columns uselocalAi. - Path persistence depends on Settings and path access, specifically
rememberLastPaths,lastInputDirectory, andlastOutputDirectory. - Final CSV output progress is backed by Background jobs.
- Change top-level CSV workflow state in
frontend/src/hooks/useAnonymizerWorkflow.ts. - Change file loading, path suggestions, or exact row count refresh in
frontend/src/hooks/useCsvAnalysis.ts. - Change column selection, default controls, or Local AI selection checks in
frontend/src/hooks/useColumnSelection.ts. - Change preview gating or preflight argument assembly in
frontend/src/hooks/usePreviewWorkflow.ts. - Change job polling, cancellation, or success settings updates in
frontend/src/hooks/useAnonymizeJob.ts. - Change settings save reconciliation in
frontend/src/hooks/usePersistentSettings.ts.
frontend/src/hooks/useAnonymizerWorkflow.tsfrontend/src/hooks/useCsvAnalysis.tsfrontend/src/hooks/useColumnSelection.tsfrontend/src/hooks/usePreviewWorkflow.tsfrontend/src/hooks/useAnonymizeJob.tsfrontend/src/hooks/usePersistentSettings.tsfrontend/src/tauri.ts