Skip to content

feat(workspaces): dispatch closeAiSidebar action on workspace switch - #8451

Merged
naman-bruno merged 3 commits into
usebruno:mainfrom
utkarsh-bruno:feat/BRU-3685
Jul 2, 2026
Merged

naman-bruno merged 3 commits into
usebruno:mainfrom
utkarsh-bruno:feat/BRU-3685

Conversation

@utkarsh-bruno

@utkarsh-bruno utkarsh-bruno commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Added a call to closeAiSidebar in the switchWorkspace action to ensure the AI sidebar is closed when switching workspaces, improving user experience and interface consistency.

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.
  • Create an issue and link to the pull request.

Summary by CodeRabbit

  • Bug Fixes
    • Switching workspaces now automatically closes the AI sidebar to keep the interface consistent.
    • Workspace switching continues to update the active workspace selection as expected.
  • Tests
    • Added Jest coverage to verify workspace switching closes the AI sidebar and updates the active workspace correctly.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3ad5e5b-1bbd-4c7f-bc73-80372e997449

📥 Commits

Reviewing files that changed from the base of the PR and between 3b38998 and 11315b2.

📒 Files selected for processing (1)
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.spec.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.spec.js

Walkthrough

switchWorkspace now closes the AI sidebar before its snapshot hydration cleanup steps. A new Jest test verifies the sidebar closes and the active workspace ID updates on workspace switch.

Changes

AI Sidebar Teardown on Workspace Switch

Layer / File(s) Summary
closeAiSidebar dispatch in switchWorkspace
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
Imports closeAiSidebar from the chat provider and dispatches it as the first step of switchWorkspace, ahead of clearing snapshot hydration timeout/session and setting snapshotReady to false.
Test coverage for sidebar closure and workspace switch
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.spec.js
Adds a Jest test that mocks @usebruno/schema and react-hot-toast, builds a preloaded Redux store, stubs window.ipcRenderer.invoke, and asserts dispatching switchWorkspace closes the AI sidebar and updates activeWorkspaceUid.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • usebruno/bruno#6456: Also modifies the switchWorkspace flow in the same actions.js file, touching related workspace-switch sequencing logic.

Suggested reviewers: helloanoop, lohit-bruno, bijin-bruno

Poem

A workspace shifts, the sidebar bows,
A tidy switch in careful rows.
Tests tap once and prove the dance,
Old state out, new state in advance.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: closing the AI sidebar when switching workspaces.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.spec.js`:
- Around line 25-31: The makeScratchCollection fixture currently hardcodes a
Unix-only pathname using /tmp, which will break on Windows. Update the pathname
construction to use an OS-agnostic path helper such as path.join() or
path.resolve() in makeScratchCollection so the generated scratch collection path
works across platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8b1c191-a9e8-4e5c-a8c6-8eed30add6d8

📥 Commits

Reviewing files that changed from the base of the PR and between 4f31e9b and 3b38998.

📒 Files selected for processing (2)
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.spec.js

@naman-bruno
naman-bruno merged commit bd271ff into usebruno:main Jul 2, 2026
17 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants