-
Notifications
You must be signed in to change notification settings - Fork 219
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
Deleting current workspace switches to another if it can instead of closing #1582
base: main
Are you sure you want to change the base?
Conversation
Jalileh
commented
Dec 19, 2024
WalkthroughThe changes in the Additionally, the deletion logic has been streamlined. If the workspace to be deleted is the only one remaining, it is deleted directly along with its associated window. Conversely, if multiple workspaces exist, the application first switches to a different workspace before proceeding with the deletion. The overall control flow has been refined to ensure that the workspace deletion process is managed more effectively, particularly when the active workspace is involved. No changes were made to the declarations of exported or public entities in this update. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
emain/emain-window.ts (2)
710-711
: Improve comment clarity and error handlingThe comment about the blank window bug should be more descriptive, and we should add error handling for the workspace switch.
- await ww.switchWorkspace(PrevNextWorkspace.workspaceid); - relaunchBrowserWindows(); // the blank window bug from 0.10.1 OCCASIONALLY occurs if this is not here, ( issue #1567 ) + try { + await ww.switchWorkspace(nextWorkspace.workspaceid); + // Relaunch browser windows to prevent blank window bug (issue #1567) + // This is a workaround for an intermittent issue in v0.10.1 where + // windows may appear blank after workspace switching + relaunchBrowserWindows(); + } catch (error) { + console.error('Failed to switch workspace:', error); + }
713-718
: Improve code organization and spacingThe code has inconsistent spacing and the window cleanup logic could be better organized.
- await WorkspaceService.DeleteWorkspace(workspaceId); - - console.log("delete-workspace done", workspaceId, ww?.waveWindowId); - - if (ww?.workspaceId == workspaceId) { - console.log("delete-workspace closing window", workspaceId, ww?.waveWindowId); - ww.destroy(); - } + try { + await WorkspaceService.DeleteWorkspace(workspaceId); + console.log("delete-workspace done", workspaceId, ww?.waveWindowId); + + if (ww?.workspaceId === workspaceId) { + console.log("delete-workspace closing window", workspaceId, ww?.waveWindowId); + ww.destroy(); + } + } catch (error) { + console.error('Failed to delete workspace:', error); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
emain/emain-window.ts
(1 hunks)
🔇 Additional comments (1)
emain/emain-window.ts (1)
702-718
: Implementation meets requirements with room for improvement
The code successfully implements the workspace switching functionality before deletion, addressing the PR objectives. The implementation includes proper handling of multiple workspaces and incorporates a fix for the blank window bug (issue #1567).
Consider implementing the suggested improvements for better code quality and reliability:
- Fix the workspace index comparison logic
- Improve error handling
- Follow consistent naming conventions
- Enhance code organization
Thank you for this submission! Please take a look at the CLA and sign it when you can. We cannot accept your submission without this. Let me know if you have any questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting a change and asking for clarity on the 0.10.1 bug.
I like this as the new default behavior, thank you very much for contributing this!