fix(settings): accurate View navigation after restore in recently deleted#4546
fix(settings): accurate View navigation after restore in recently deleted#4546waleedlatif1 merged 3 commits intostagingfrom
Conversation
…eted
Files now deep-link to /files/{id} (was /files), and folders expand
the restored folder + its parent chain in the sidebar before navigating
to /w so the user actually lands on the item they restored.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Files now route to Reviewed by Cursor Bugbot for commit 92cca40. Configure here. |
Greptile SummaryFixes the View button in Settings → Recently Deleted so it navigates to the actual restored item for all resource types. Files now route to
Confidence Score: 5/5The change is narrowly scoped to navigation logic triggered by a single user action — no data mutations, no store writes other than expand state, and no API surface is modified. All changed paths are in event handlers isolated to this component. The merged-map approach for the folder parent walk correctly handles the post-restore refetch window. File routing is a straightforward URL fix. No regressions are expected for the unchanged workflow/table/knowledge routes. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant RD as RecentlyDeleted
participant API as Restore API
participant FS as useFolderStore
participant R as Router
U->>RD: Click "Restore"
RD->>API: mutate(restore)
API-->>RD: onSuccess → restoredItems.set(id)
RD-->>U: Show "Restored" + View button
U->>RD: Click "View"
alt "resource.type === 'folder'"
RD->>RD: Merge foldersQuery.data (archived) + activeFoldersQuery.data (active)
loop walk parent chain
RD->>FS: setExpanded(folderId, true)
end
RD->>R: "router.push(/workspace/{id}/w)"
else "resource.type === 'file'"
RD->>R: "router.push(/workspace/{id}/files/{fileId})"
else workflow / table / knowledge
RD->>R: "router.push(/workspace/{id}/{type}/{id})"
end
Reviews (2): Last reviewed commit: "fix: fall back to archived folders for p..." | Re-trigger Greptile |
The restored folder may not be in the active folders cache yet when View is clicked (the invalidation+refetch fires from onSettled, after onSuccess surfaces the View button). Merge archived folder data — where the restored item still lives — into the lookup map so the expansion loop can always resolve the folder and walk its parent chain. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 92cca40. Configure here.
Document the size-* shorthand as the canonical pattern across CLAUDE.md, AGENTS.md, .claude rules, .cursor + .agents commands, and the emcn design-review skill. Default icon size is size-[14px]. Treat h-[Npx] w-[Npx] and h-N w-N pairs as refactor targets. Also migrate the remaining occurrences in recently-deleted.tsx. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
In
Settings → Recently Deleted, after restoring an item the View button rendered for every resource type but only navigated correctly for workflows/tables/knowledge bases. Files dropped users on the generic files list, and folders dropped users on the workflows root with nothing focused.This change makes View land on the actual restored item:
/workspace/{id}/files/{fileId}(was/workspace/{id}/files). The[fileId]route already exists andfiles.tsxreadsparams.fileIdto focus the file.useFoldersquery and callsuseFolderStore.setExpanded(id, true)for the folder + all ancestors before pushing to/w. The folder store survives client-side navigation, so the sidebar opens with the restored folder expanded and visible.Also small cleanups in the same component:
toError(error).messageinstead of aninstanceof Errorternary, dropped an unnecessary Fragment aroundconfig.renderTabIcon, and movedtype ResourceTypeabove its first use.Test plan
/w/{id}for that workflow/tables/{id}/knowledge/{id}/files/{id}with the file focused