Repository navigation
fix: show unsaved changes prompt when closing tab with Cmd+W - #8245
Conversation
WalkthroughThe Cmd+W keyboard shortcut handler is updated to treat ChangesClose Tab Keyboard Shortcut
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Suggested labels
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)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js (1)
50-54: 💤 Low valueRequest-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 existingisItemARequestfromutils/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
📒 Files selected for processing (1)
packages/bruno-app/src/components/RequestTabs/RequestTab/index.js
|
LGTM, waiting on tests |
|
e2e for the same are a part of #8071 so ignoring them for this specific PR |
Description
Fixes #8244
Fixes #3264
JIRA
Pressing
Cmd+W/Ctrl+Won a modified request tab closed it immediatelywithout the unsaved-changes prompt because the
closeTabhandler's conditionwas missing the
'http-request'type. Added it so HTTP tabs get the samedirty-state check as all other request types.
Contribution Checklist:
Summary by CodeRabbit