fix(file): use file-upload subblock#3862
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Refactors the editor Changes Written by Cursor Bugbot for commit af4eb8b. Configure here. |
Greptile SummaryThis PR replaces the Key changes:
Confidence Score: 5/5Safe to merge; the one flagged regression is a spurious extra read-only fetch in preview mode, not a data or functional correctness issue. All findings are P2 (minor behavioural regression). The core logic change — extracting fileName from the file object for the append tool — is correct, and the React Query migration follows the established project pattern. No data integrity, security, or primary-path breakage was found. apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx — missing isPreview guard on the query enabled condition and refetch calls. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant FileUpload as FileUpload Component
participant RQ as React Query (useWorkspaceFiles)
participant API as /api/workspaces/:id/files
participant Block as FileV3Block params()
participant AppendTool as file_append tool
User->>FileUpload: Opens append dropdown
FileUpload->>RQ: refetchWorkspaceFiles()
RQ->>API: GET /api/workspaces/{workspaceId}/files
API-->>RQ: WorkspaceFileRecord[]
RQ-->>FileUpload: workspaceFiles updated
alt User selects existing file
User->>FileUpload: Picks file from combobox
FileUpload->>FileUpload: handleSelectWorkspaceFile(fileId)
FileUpload->>FileUpload: setStoreValue({ name, path, key, size, type })
else User uploads new file
User->>FileUpload: Clicks Upload New File
FileUpload->>API: POST /api/files/upload
API-->>FileUpload: { file: { url, key } }
FileUpload->>RQ: invalidateQueries(workspaceFilesKeys.lists())
FileUpload->>FileUpload: setStoreValue({ name, path, key, size, type })
end
User->>Block: Runs workflow (file_append operation)
Block->>Block: appendInput = params.appendFileInput
alt appendInput is string (advanced mode)
Block->>Block: fileName = appendInput.trim()
else appendInput is object (file-upload mode)
Block->>Block: normalizeFileInput(appendInput, single true)
Block->>Block: fileName = file?.name
end
Block->>AppendTool: { fileName, content, workspaceId }
AppendTool->>API: POST /api/tools/file/manage { operation: append, fileName }
API-->>AppendTool: { success, data }
AppendTool-->>Block: ToolResponse
Reviews (1): Last reviewed commit: "fix(file): use file-upload subblock" | Re-trigger Greptile |
...mponents/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx
Outdated
Show resolved
Hide resolved
|
bugbot run |
Summary
Replace append tool file dropdown with file upload subblock
Type of Change
Testing
Tested manually
Checklist