Add restore endpoints and ui#3570
Conversation
PR SummaryMedium Risk Overview Introduces new Replaces the custom in-workflow notification UI/animations with a shared Written by Cursor Bugbot for commit aab1381. This will update automatically on new commits. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds a "Recently Deleted" feature, allowing users to restore soft-deleted workflows, tables, knowledge bases, and workspace files from a new Settings section. It introduces four new Key changes and issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User (Recently Deleted UI)
participant RD as RecentlyDeleted Component
participant Q as React Query Hooks
participant API as REST API Routes
participant SVC as Service Layer (lib/)
participant DB as Database
U->>RD: Visit Settings → Recently Deleted
RD->>Q: useWorkflows(scope: archived)
RD->>Q: useTablesList(archived)
RD->>Q: useKnowledgeBasesQuery(scope: archived)
RD->>Q: useWorkspaceFiles(archived)
Q->>API: GET /api/workflows?scope=archived
Q->>API: GET /api/tables?scope=archived
Q->>API: GET /api/knowledge?scope=archived
Q->>API: GET /api/workspaces/{id}/files?scope=archived
API-->>Q: Archived resource lists
Q-->>RD: Merged & sorted DeletedResource[]
U->>RD: Click "Restore" on an item
RD->>Q: mutate(resourceId) via useRestoreWorkflow / useRestoreTable / useRestoreKnowledgeBase / useRestoreWorkspaceFile
Q->>API: POST /api/workflows/{id}/restore
Note over API: Auth check + permission check
API->>SVC: restoreWorkflow(id, requestId)
SVC->>DB: BEGIN TRANSACTION
SVC->>DB: UPDATE workflow SET archivedAt = NULL
SVC->>DB: UPDATE schedules, webhooks, chats, forms, mcp_tools, a2a_agents SET archivedAt = NULL
DB-->>SVC: OK
SVC-->>API: { restored: true }
API-->>Q: 200 { success: true }
Q->>Q: invalidateQueries(workflowKeys.lists())
Q-->>RD: onSuccess → toast.success("Workflow restored")
RD-->>U: Toast shown + item removed from list
|
|
|
||
| type ResourceType = 'all' | 'workflow' | 'table' | 'knowledge' | 'file' | ||
|
|
||
| const ICON_CLASS = 'h-[14px] w-[14px]' |
There was a problem hiding this comment.
is this correct or can this also be defined?
| .update(a2aAgent) | ||
| .set({ archivedAt: null, updatedAt: now }) | ||
| .where(eq(a2aAgent.workflowId, workflowId)) | ||
| }) |
There was a problem hiding this comment.
Workflow restore leaves triggers permanently disabled after restore
High Severity
archiveWorkflow explicitly disables operational state on children — setting status: 'disabled' on schedules, isActive: false on webhooks/chats/forms, isPublished: false on A2A agents, and isDeployed: false/isPublicApi: false on the workflow itself. But restoreWorkflow only clears archivedAt without restoring any of these flags. It also skips workflowDeploymentVersion entirely. After a restore, the workflow and all its triggers remain effectively dead. The knowledge base restore correctly sets connector status: 'active', showing the expected pattern.
There was a problem hiding this comment.
Making the decision now that workflows should restore back to undeployed. Users can manually redeploy after the fact.
There was a problem hiding this comment.
Certain booleans like chat and agent we cannot currently infer whether they were deployed or not so hard to go back.
apps/sim/app/workspace/[workspaceId]/settings/components/recently-deleted/recently-deleted.tsx
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/settings/components/recently-deleted/recently-deleted.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


Summary
WIP
Fixes #(issue)
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Checklist
Screenshots/Videos