feat: allow user to change default workspace location (#6816)#7485
feat: allow user to change default workspace location (#6816)#7485mikiubo wants to merge 1 commit intousebruno:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds a "Set as default" action in Manage Workspace, implements an IPC handler to persist a default workspace path, adjusts default-name derivation to prefer an explicit workspace name, and extends the Redux updateWorkspace reducer to accept an optional newUid for UID updates. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant ManageWorkspace as ManageWorkspace (UI)
participant ipcRenderer as ipcRenderer
participant ipcMain as ipcMain (Electron)
participant WorkspaceMgr as WorkspaceManager
participant Redux as Redux Store
participant Toast as Toast Notification
User->>ManageWorkspace: Click "Set as default"
ManageWorkspace->>ManageWorkspace: Skip if already default
ManageWorkspace->>ipcRenderer: invoke renderer:set-default-workspace-path(workspacePath)
ipcRenderer->>ipcMain: IPC call
ipcMain->>WorkspaceMgr: validate & set default workspace path
WorkspaceMgr->>WorkspaceMgr: get previous default UID
WorkspaceMgr->>WorkspaceMgr: revert previous default type (if any)
WorkspaceMgr->>WorkspaceMgr: mark new default type
ipcMain-->>ipcRenderer: return { success, previousDefaultUid }
ipcRenderer->>Redux: dispatch updateWorkspace({ uid: previousDefaultUid, ... }) (and for new default)
Redux->>Redux: apply updates, handle newUid -> update activeWorkspaceUid if needed
ManageWorkspace->>Toast: show success/failure
Toast->>User: display notification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Malware alert
…On Fri, 13 Mar 2026 at 22:18, mikiubo ***@***.***> wrote:
Add "Set as default" option to workspace context menu, persist the default
workspace in lastOpenedWorkspaces to prevent losing it on change, and
preserve the original workspace name instead of always overriding it with
"My Workspace".
Description image.png (view on web)
<https://github.com/user-attachments/assets/32f573cf-69b9-423c-b33a-a93f68a7629e> Contribution
Checklist:
- *I've used AI significantly to create this pull request*
- *The pull request only addresses one issue or adds one feature.*
- *The pull request does not introduce any breaking changes*
- *I have added screenshots or gifs to help explain the change if
applicable.*
- *I have read the contribution guidelines
<https://github.com/usebruno/bruno/blob/main/contributing.md>.*
- *Create an issue and link to the pull request.*
Note: Keeping the PR small and focused helps make it easier to review and
merge. If you have multiple changes you want to make, please consider
submitting them as separate pull requests.
Publishing to New Package Managers
Please see here <http://../publishing.md> for more information.
------------------------------
You can view, comment on, or merge this pull request online at:
#7485
Commit Summary
- e0d4272
<e0d4272>
feat: allow user to change default workspace location (#6816)
File Changes
(2 files <https://github.com/usebruno/bruno/pull/7485/files>)
- *M* packages/bruno-app/src/components/ManageWorkspace/index.js
<https://github.com/usebruno/bruno/pull/7485/files#diff-4db1ee7667ee6c442a456710aa7174dcf9fbdf2d0e025ea6a639b82b3fadadd7>
(42)
- *M* packages/bruno-electron/src/ipc/workspace.js
<https://github.com/usebruno/bruno/pull/7485/files#diff-c2ecfe9532ead22f58cc5fd33e6fe72cad75572a8427659fe7f86b1acbc78434>
(4)
Patch Links:
- https://github.com/usebruno/bruno/pull/7485.patch
- https://github.com/usebruno/bruno/pull/7485.diff
—
Reply to this email directly, view it on GitHub
<#7485>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BC2ZHPRC5TFIMNOBOULS5W34QR3LRAVCNFSM6AAAAACWRPGOWKVHI2DSMVQWIX3LMV43ASLTON2WKOZUGA3TGNBUGMZDENA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 64-98: The IPC handler that calls savePreferences must also update
the in-memory cache on the singleton defaultWorkspaceManager so the session
reflects the new default immediately; in the
ipcMain.handle('renderer:save-preferences') flow, after await
savePreferences(preferences) (and only if
preferences?.general?.defaultWorkspacePath is present), require the
defaultWorkspaceManager and call its
setDefaultWorkspacePath(preferences.general.defaultWorkspacePath) so the
manager's this.defaultWorkspacePath is updated; keep the existing error handling
and await the setDefaultWorkspacePath call to ensure cache and disk stay in
sync.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fd496433-82ed-42f9-a9c8-f92ba71d25af
📒 Files selected for processing (2)
packages/bruno-app/src/components/ManageWorkspace/index.jspackages/bruno-electron/src/ipc/workspace.js
e0d4272 to
ad1ea07
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-electron/src/ipc/workspace.js`:
- Around line 625-632: The handler for 'renderer:set-default-workspace-path'
currently accepts any path and swallows persistence issues; update the
ipcMain.handle implementation to first validate the incoming workspacePath
(e.g., confirm it exists and is a directory using fs.stat or an existing
validation helper) and reject invalid paths with a thrown error, then call await
defaultWorkspaceManager.setDefaultWorkspacePath(workspacePath) and do not
swallow errors — either remove the try/catch or rethrow caught errors so
persistence failures bubble up; additionally, after the call assert persistence
succeeded (for example by comparing
defaultWorkspaceManager.getDefaultWorkspacePath() to workspacePath) and throw if
they differ so the renderer never receives { success: true } for an invalid or
non-persisted default.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2c49b3a1-15fc-435c-ac35-737f99b666d7
📒 Files selected for processing (2)
packages/bruno-app/src/components/ManageWorkspace/index.jspackages/bruno-electron/src/ipc/workspace.js
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bruno-app/src/components/ManageWorkspace/index.js
ad1ea07 to
91f3fad
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js (1)
116-122: Consider avoiding!importantunless strictly necessary.Multiple
!importantdeclarations here may indicate specificity conflicts. If these are needed to override inherited styles from a parent component, consider restructuring the CSS hierarchy instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js` around lines 116 - 122, The .section-header rules in StyledWrapper.js use multiple !important declarations; remove the !important flags and instead resolve specificity by either increasing selector specificity (e.g., target the styled component wrapper + .section-header or use a nested selector), or convert these rules into the styled-component that renders the section header so the styles are applied directly (e.g., add props or a dedicated styled component for SectionHeader) to avoid needing !important; update the CSS in StyledWrapper.js by removing !important and applying one of these specificity/structural approaches to ensure the intended margins/padding/border-radius are respected.packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/StyledWrapper.js (1)
117-123: Inconsistent styling with sibling component.This
.section-headerblock omits!importantwhilepackages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.jsuses!importanton the same properties. Consider unifying the approach across both files.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/StyledWrapper.js` around lines 117 - 123, The .section-header rule in StyledWrapper.js is missing the !important flags used by the sibling component; update the CSS declarations for .section-header (margin-inline, padding-left, padding-right, padding-block, and border-radius if necessary) to include !important on the same properties so the styling is consistent with the other EnvironmentList StyledWrapper and avoids specificity mismatches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 65-66: The "Set as default" menu item is still rendered for
workspaces without a pathname; update the render logic in ManageWorkspace (where
workspace and currentDefault are used) to skip or hide the "Set as default"
action when workspace.pathname is falsy or workspace.type === 'default'. Locate
the menu item rendering for the SetAsDefault action and add the same guard used
earlier (workspace.type === 'default' || !workspace.pathname) so the menu option
is not shown for pathless workspaces.
- Around line 69-73: Guard the remap dispatch so you don't create duplicate
'default' UIDs: only call dispatch(updateWorkspace({ uid: currentDefault.uid,
newUid: result.previousDefaultUid, type: 'workspace' })) when both
currentDefault and result.previousDefaultUid are truthy; otherwise skip that
remap before you dispatch updateWorkspace({ uid: workspace.uid, newUid:
'default', type: 'default' }) and show the toast, ensuring you reference
currentDefault, result.previousDefaultUid, dispatch(updateWorkspace...), and
workspace.uid to locate the change.
---
Nitpick comments:
In
`@packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js`:
- Around line 116-122: The .section-header rules in StyledWrapper.js use
multiple !important declarations; remove the !important flags and instead
resolve specificity by either increasing selector specificity (e.g., target the
styled component wrapper + .section-header or use a nested selector), or convert
these rules into the styled-component that renders the section header so the
styles are applied directly (e.g., add props or a dedicated styled component for
SectionHeader) to avoid needing !important; update the CSS in StyledWrapper.js
by removing !important and applying one of these specificity/structural
approaches to ensure the intended margins/padding/border-radius are respected.
In
`@packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/StyledWrapper.js`:
- Around line 117-123: The .section-header rule in StyledWrapper.js is missing
the !important flags used by the sibling component; update the CSS declarations
for .section-header (margin-inline, padding-left, padding-right, padding-block,
and border-radius if necessary) to include !important on the same properties so
the styling is consistent with the other EnvironmentList StyledWrapper and
avoids specificity mismatches.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8baab5c5-fa8a-459d-b380-bcb8fefb473f
📒 Files selected for processing (11)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/StyledWrapper.jspackages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.jspackages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.jspackages/bruno-app/src/components/ManageWorkspace/index.jspackages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/EnvironmentDetails/StyledWrapper.jspackages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/StyledWrapper.jspackages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.jspackages/bruno-app/src/providers/ReduxStore/slices/workspaces/index.jspackages/bruno-electron/src/app/apiSpecs.jspackages/bruno-electron/src/app/workspace-watcher.jspackages/bruno-electron/src/ipc/workspace.js
91f3fad to
6ebf8ba
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/bruno-electron/src/ipc/workspace.js (1)
625-639:⚠️ Potential issue | 🟠 MajorDo not return success if default workspace persistence can fail silently.
defaultWorkspaceManager.setDefaultWorkspacePath()(inpackages/bruno-electron/src/store/default-workspace.js) catches preference write failures, so this handler can still return{ success: true }even when the update is not persisted. Please make persistence failures bubble up before returning success.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/ipc/workspace.js` around lines 625 - 639, The handler renderer:set-default-workspace-path currently assumes defaultWorkspaceManager.setDefaultWorkspacePath succeeded, but that method swallows preference-write errors so persistence can fail silently; update the flow so persistence failures bubble up: either modify defaultWorkspaceManager.setDefaultWorkspacePath (in default-workspace.js) to throw on write failure instead of catching/suppressing, or make it return a success boolean and have the ipc handler check that result and throw if false before returning { success: true }; ensure you reference the getWorkspaceUid(previousDefaultPath) usage remains unchanged and only return success after confirmed persistence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/bruno-electron/src/ipc/workspace.js`:
- Around line 625-639: The handler renderer:set-default-workspace-path currently
assumes defaultWorkspaceManager.setDefaultWorkspacePath succeeded, but that
method swallows preference-write errors so persistence can fail silently; update
the flow so persistence failures bubble up: either modify
defaultWorkspaceManager.setDefaultWorkspacePath (in default-workspace.js) to
throw on write failure instead of catching/suppressing, or make it return a
success boolean and have the ipc handler check that result and throw if false
before returning { success: true }; ensure you reference the
getWorkspaceUid(previousDefaultPath) usage remains unchanged and only return
success after confirmed persistence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c2867c96-6d2a-4bb3-b144-8ebfca077af2
📒 Files selected for processing (5)
packages/bruno-app/src/components/ManageWorkspace/index.jspackages/bruno-app/src/providers/ReduxStore/slices/workspaces/index.jspackages/bruno-electron/src/app/apiSpecs.jspackages/bruno-electron/src/app/workspace-watcher.jspackages/bruno-electron/src/ipc/workspace.js
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bruno-app/src/components/ManageWorkspace/index.js
6ebf8ba to
6717787
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bruno-app/src/components/ManageWorkspace/index.js (1)
182-186: Filter out falsy items from the menu array.When
workspace.pathnameis falsy, line 185 evaluates tofalse, which gets included in the items array. This causes React console warnings (missing keys) and empty menu items rendered in the DOM.Proposed fix
items={[ { id: 'rename', label: 'Rename', onClick: () => handleRenameClick(workspace) }, { id: 'remove', label: 'Remove', onClick: () => handleCloseClick(workspace) }, workspace.pathname && { id: 'set_as_default', label: 'Set as default', onClick: () => handleSetAsDefault(workspace) } - ]} + ].filter(Boolean)}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/ManageWorkspace/index.js` around lines 182 - 186, The items array passed to the menu includes a falsy boolean when workspace.pathname is falsy, causing empty menu entries; update the construction of the items array in ManageWorkspace so only valid objects are included (e.g., build the array with the three item objects and then remove falsy entries via .filter(Boolean) or conditionally push the set_as_default object), targeting the items assignment where handleRenameClick, handleCloseClick, and handleSetAsDefault are used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 182-186: The items array passed to the menu includes a falsy
boolean when workspace.pathname is falsy, causing empty menu entries; update the
construction of the items array in ManageWorkspace so only valid objects are
included (e.g., build the array with the three item objects and then remove
falsy entries via .filter(Boolean) or conditionally push the set_as_default
object), targeting the items assignment where handleRenameClick,
handleCloseClick, and handleSetAsDefault are used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 471d4314-a16e-40bf-bd60-e4a26ad18733
📒 Files selected for processing (5)
packages/bruno-app/src/components/ManageWorkspace/index.jspackages/bruno-app/src/providers/ReduxStore/slices/workspaces/index.jspackages/bruno-electron/src/app/apiSpecs.jspackages/bruno-electron/src/app/workspace-watcher.jspackages/bruno-electron/src/ipc/workspace.js
Add "Set as default" option to workspace context menu, persist the default workspace in lastOpenedWorkspaces to prevent losing it on change, and preserve the original workspace name instead of always overriding it with "My Workspace".
6717787 to
7cf2a33
Compare
Add "Set as default" option to workspace context menu, persist the default workspace in lastOpenedWorkspaces to prevent losing it on change, and preserve the original workspace name instead of always overriding it with "My Workspace".
Description
fixes: #6816
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Summary by CodeRabbit
New Features
Improvements