v0.6.48: import csv into tables, subflow fixes, CSP updates #4204
v0.6.48: import csv into tables, subflow fixes, CSP updates #4204waleedlatif1 merged 3 commits intomainfrom
Conversation
waleedlatif1
commented
Apr 16, 2026
- feat(tables): import csv into existing tables (feat(tables): import csv into existing tables #4199)
- fix(executor): subflow edge keys mismatch (fix(executor): subflow edge keys mismatch #4202)
- improvement(ui): remove React anti-patterns, fix CSP violations (improvement(ui): remove React anti-patterns, fix CSP violations #4203)
* feat(tables): import csv into existing tables * update types * address comments * address comment
* fix(executor): subflow edge keys mismatch' * improve style
* improvement(ui): remove React anti-patterns, fix CSP violations * fix(ui): restore useMemo on existingKeys — it is observed by useAvailableResources * improvement(ui): add RefreshCw icon, update Bell SVG, active state styling for header actions * minor UI improvements
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Refactors CSV parsing/schema/mapping/coercion into shared Fixes executor loop reset behavior by only reactivating deactivated edges where the source node is inside the reset set (avoiding substring-matching false positives), adds regressions, and ensures loop/parallel containers emit success completion events so trace spans can use user-configured container names. Includes small UI/security polish: adds Reviewed by Cursor Bugbot for commit 6fd1767. Configure here. |
Greptile SummaryThis release bundles three improvements: CSV import into existing tables (append or replace with column mapping), a subflow edge-key bug fix that was stalling loops on subsequent iterations, and a batch of React anti-pattern cleanups (effect-to-render-phase state sync, memoized tab items, CSP additions). The core logic is solid — Confidence Score: 5/5Safe to merge — all findings are non-blocking style suggestions. No P0 or P1 issues found. The replace-mode transaction is correctly locked and rowCount is dynamically computed so no stale-counter risk. The edge-manager fix is well-scoped and tested. Remaining comments are style cleanup (import paths, type deduplication, unnecessary dep). apps/sim/hooks/queries/tables.ts (duplicated type declarations), apps/sim/app/workspace/[workspaceId]/tables/components/import-csv-dialog/import-csv-dialog.tsx (sub-module import path, mutateAsync dep) Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User (Browser)
participant D as ImportCsvDialog
participant API as POST /api/table/[tableId]/import-csv
participant SVC as replaceTableRows / batchInsertRows
participant DB as Database
U->>D: Drop / select CSV file
D->>D: parseCsvBuffer (client-side preview)
D->>D: buildAutoMapping (auto-match headers → columns)
D->>U: Show mapping table + mode toggle
U->>D: Confirm (Append or Replace)
D->>API: POST FormData {file, workspaceId, mode, mapping}
API->>API: checkSessionOrInternalAuth
API->>API: checkAccess (write permission)
API->>API: parseCsvBuffer + validateMapping
alt mode = append
API->>SVC: batchInsertRows (chunked)
SVC->>DB: INSERT rows
else mode = replace
API->>SVC: replaceTableRows
SVC->>DB: SELECT FOR UPDATE (table definition)
SVC->>DB: DELETE all rows
SVC->>DB: INSERT new rows (batched)
end
API-->>D: {success, insertedCount, deletedCount, ...}
D-->>U: toast + onImported callback
Reviews (1): Last reviewed commit: "improvement(ui): remove React anti-patte..." | Re-trigger Greptile |
| } | ||
|
|
There was a problem hiding this comment.
Duplicated types already exported from
@/lib/table
CsvHeaderMapping and CsvImportMode are declared locally here but are already exported from @/lib/table (via csv-import.ts). Importing from the canonical source prevents the two definitions from drifting.
| } | |
| export type { CsvHeaderMapping, CsvImportMode } from '@/lib/table' |
Context Used: Import patterns for the Sim application (source)
| import { type CsvImportMode, useImportCsvIntoTable } from '@/hooks/queries/tables' | ||
|
|
There was a problem hiding this comment.
Bypass barrel export for
@/lib/table
csv-import is re-exported through @/lib/table/index.ts, so the sub-module path can be replaced with the barrel. The same pattern appears in apps/sim/lib/copilot/tools/server/table/user-table.ts.
| import { type CsvImportMode, useImportCsvIntoTable } from '@/hooks/queries/tables' | |
| import { buildAutoMapping, parseCsvBuffer } from '@/lib/table' |
Context Used: Import patterns for the Sim application (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| const appendCapacityDeficit = useMemo(() => { | ||
| if (!parsed || mode !== 'append') return 0 |
There was a problem hiding this comment.
mutateAsync reference unnecessarily extracted into a dep
importMutation.mutateAsync is stable in TanStack Query v5, so extracting it to importCsv and including it in the useCallback dep array adds indirection without benefit. Call importMutation.mutateAsync directly inside the callback and omit it from deps.
| const appendCapacityDeficit = useMemo(() => { | |
| if (!parsed || mode !== 'append') return 0 | |
| const handleSubmit = useCallback(async () => { | |
| if (!parsed || !canSubmit) return | |
| setSubmitError(null) | |
| try { | |
| const result = await importMutation.mutateAsync({ |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!