-
Notifications
You must be signed in to change notification settings - Fork 964
fix(desktop): toast and switch workspace when deleting in v2 #3661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Kitenite
merged 11 commits into
main
from
when-deleting-a-workspace-in-v2-please-toast-that-its-deleting-and-choose-a-different-workspace-to-m
Apr 23, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e6837fd
fix(desktop): toast and switch workspace when deleting in v2
Kitenite 1df7960
fix(desktop): simplify to fire-and-forget info toast
Kitenite 854c6e4
revert: drop workspace-switch-on-delete, keep only the deleting toast
Kitenite 53f487c
fix(desktop): navigate off workspace early on delete or hide
Kitenite c54ad9c
fix(desktop): switch isActive to useParams so early-nav actually fires
Kitenite 5077051
fix(desktop): pick the next visible sidebar workspace directly
Kitenite 86e2712
refactor(desktop): use onDeleting callback instead of extracted hook
Kitenite 694c892
fix(desktop): use useParams for isActive so nav actually fires
Kitenite 1824883
fix(desktop): fire onDeleting before dialog close + markDeleting
Kitenite d6d4a4b
fix(desktop): restore useNavigateAwayFromWorkspace hook so nav fires
Kitenite 1c343e3
chore(desktop): clean stale docs + minimize diff before merge
Kitenite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...icated/_dashboard/components/DashboardSidebar/hooks/useNavigateAwayFromWorkspace/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { useNavigateAwayFromWorkspace } from "./useNavigateAwayFromWorkspace"; |
27 changes: 27 additions & 0 deletions
27
...nents/DashboardSidebar/hooks/useNavigateAwayFromWorkspace/useNavigateAwayFromWorkspace.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { useNavigate, useParams } from "@tanstack/react-router"; | ||
| import { navigateToV2Workspace } from "renderer/routes/_authenticated/_dashboard/utils/workspace-navigation"; | ||
| import { useCollections } from "renderer/routes/_authenticated/providers/CollectionsProvider"; | ||
| import { getFlattenedV2WorkspaceIds } from "../../utils/getFlattenedV2WorkspaceIds"; | ||
|
|
||
| /** | ||
| * If the user is viewing the workspace about to be removed, jump to the | ||
| * next visible sidebar sibling (or home). No-op otherwise. Called | ||
| * directly at the callsite — not via a callback prop — because | ||
| * plumbing this through dialog onDeleting was silently dropping the nav. | ||
| */ | ||
| export function useNavigateAwayFromWorkspace() { | ||
| const navigate = useNavigate(); | ||
| const params = useParams({ strict: false }); | ||
| const collections = useCollections(); | ||
|
|
||
| return (workspaceId: string) => { | ||
| if (params.workspaceId !== workspaceId) return; | ||
| const ids = getFlattenedV2WorkspaceIds(collections); | ||
| const next = ids.find((id) => id !== workspaceId); | ||
| if (next) { | ||
| void navigateToV2Workspace(next, navigate); | ||
| } else { | ||
| void navigate({ to: "/" }); | ||
| } | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.