Skip to content

fix: show unsaved changes prompt when closing tab with Cmd+W - #8245

Merged
sid-bruno merged 1 commit into
usebruno:mainfrom
bhavik168:bugfix/cmd-w-unsaved-changes-prompt
Jun 12, 2026
Merged

sid-bruno merged 1 commit into
usebruno:mainfrom
bhavik168:bugfix/cmd-w-unsaved-changes-prompt

Conversation

@bhavik168

@bhavik168 bhavik168 commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #8244
Fixes #3264

JIRA

Pressing Cmd+W / Ctrl+W on a modified request tab closed it immediately
without the unsaved-changes prompt because the closeTab handler's condition
was missing the 'http-request' type. Added it so HTTP tabs get the same
dirty-state check as all other request types.

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
    • Fixed close tab keyboard shortcut to consistently display unsaved changes confirmation across all request types

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The Cmd+W keyboard shortcut handler is updated to treat http-request tabs identically to other request-type tabs (request, grpc-request, ws-request, graphql-request) when checking for unsaved changes before closing.

Changes

Close Tab Keyboard Shortcut

Layer / File(s) Summary
HTTP-Request tab type in close shortcut
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js
The close-tab keyboard shortcut's request-type conditional is expanded to include http-request tab type, ensuring the unsaved-changes prompt displays consistently across all request tab variants.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested labels

size/M

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno

Poem

🎹 A keystroke that once stole away,
Now pauses—unsaved work to save the day,
HTTP requests stand with comrades tall,
Cmd+W checks them one and all. ✨

🚥 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 describes the main fix: enabling the unsaved changes prompt when closing tabs with Cmd+W.
Linked Issues check ✅ Passed The code change directly addresses both linked issues by adding 'http-request' to the closeTab handler's type check, ensuring the unsaved-changes prompt appears before closing modified HTTP request tabs.
Out of Scope Changes check ✅ Passed The change is narrowly focused on fixing the specific regression; only one line modified in the closeTab handler, no unrelated changes present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@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.

🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js (1)

50-54: 💤 Low value

Request-type check pattern appears twice.

The request-type conditional (tab.type === 'request' || tab.type === 'http-request' || ...) appears at lines 50-54 and line 209. Both are now consistent after this change. A helper constant or predicate could reduce duplication, but per coding guidelines ("Avoid abstractions unless the exact same code is being used in more than 3 places"), this doesn't yet meet the threshold. If more instances appear, consider extracting to a shared utility or using the existing isItemARequest from utils/tabs/index.js.

Also applies to: 209-209

🤖 Prompt for 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.

In `@packages/bruno-app/src/components/RequestTabs/RequestTab/index.js` around
lines 50 - 54, There are two identical request-type checks assigned to
isRequestType; replace the duplicated conditional with the existing helper
isItemARequest from utils/tabs/index.js: import isItemARequest, then set
isRequestType = isItemARequest(tab) in both places (preserve the isRequestType
variable name and any surrounding logic) so the duplicate logic is centralized
and easier to maintain.
🤖 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.

Nitpick comments:
In `@packages/bruno-app/src/components/RequestTabs/RequestTab/index.js`:
- Around line 50-54: There are two identical request-type checks assigned to
isRequestType; replace the duplicated conditional with the existing helper
isItemARequest from utils/tabs/index.js: import isItemARequest, then set
isRequestType = isItemARequest(tab) in both places (preserve the isRequestType
variable name and any surrounding logic) so the duplicate logic is centralized
and easier to maintain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 76f30615-2adb-45b2-9266-1d21bdfaa342

📥 Commits

Reviewing files that changed from the base of the PR and between 59b4a16 and 822baf9.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/RequestTabs/RequestTab/index.js

@sid-bruno sid-bruno added the adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers label Jun 12, 2026
@sid-bruno

Copy link
Copy Markdown
Collaborator

LGTM, waiting on tests

@sid-bruno sid-bruno removed the adopted-by-maintainers PR needs additional work and is now being worked on by the maintainers label Jun 12, 2026
@sid-bruno

Copy link
Copy Markdown
Collaborator

e2e for the same are a part of #8071 so ignoring them for this specific PR

@sid-bruno
sid-bruno merged commit 13363d7 into usebruno:main Jun 12, 2026
17 of 19 checks passed
abhishekp-bruno pushed a commit to abhishekp-bruno/bruno that referenced this pull request Jun 17, 2026
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.

Regression: Cmd+W closes modified request tab without unsaved changes prompt Command + W closes tab without prompt

2 participants