feat: add "Duplicate as Tab" action to request tab menu#7945
feat: add "Duplicate as Tab" action to request tab menu#7945brunorodmoreira wants to merge 3 commits into
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a "Duplicate as Tab" menu action in RequestTab that dispatches a new Redux thunk, ChangesDuplicate as Tab Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
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/components/RequestTabs/RequestTab/index.js`:
- Around line 697-701: The duplicate handler handleDuplicateAsTab uses
currentTabItem.uid without guarding against a briefly missing currentTabItem,
which can throw; update handleDuplicateAsTab to first verify currentTabItem and
currentTabItem.uid (and optionally collection.uid) exist, return early or show a
user-friendly toast if missing, and only then call
dispatch(cloneItemAsTransient(currentTabItem.uid, collection.uid)). Ensure error
handling for the dispatch remains (toast.error on catch) so the flow is safe if
state desyncs.
🪄 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: 1718b114-d05d-4bd7-a2ea-b5ef762dfcdd
📒 Files selected for processing (2)
packages/bruno-app/src/components/RequestTabs/RequestTab/index.jspackages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
There was a problem hiding this comment.
Pull request overview
Adds a new “Duplicate as Tab” option to the request tab context menu, enabling users to duplicate the currently opened request into the collection’s transient (temp-directory) request space and open it as a new unsaved tab—similar to Postman’s “Duplicate Tab” workflow.
Changes:
- Added a new collections thunk action (
cloneItemAsTransient) that clones an existing request into the collection’s transient directory and queues it to open as a non-preview tab. - Added a “Duplicate as Tab” menu item to the request tab right-click menu, with basic enable/disable logic based on tab type.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js | Adds cloneItemAsTransient to duplicate a request into the transient directory and open it via the existing task-queue flow. |
| packages/bruno-app/src/components/RequestTabs/RequestTab/index.js | Exposes the new action via a “Duplicate as Tab” entry in the request tab context menu. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The menu item is already disabled when currentTabItem/isRequestTab is falsy, but mirrors the defensive pattern used elsewhere in this file (e.g. the currentTabUid guard) and prevents a theoretical NPE if state desyncs between render and click. Per CodeRabbit review on usebruno#7945.
Replaces an inline list of request types with the canonical isItemARequest helper. Avoids drift if new request types are added and matches how the rest of the codebase classifies items. Per Copilot review on usebruno#7945.
Mirrors Postman's "Duplicate Tab": creates an unsaved transient copy of the current request in a new tab, pre-seeded with the full request state (including unsaved draft changes). Avoids the friction of the existing Clone modal, which requires a name and immediately persists to disk. Reuses the existing transient-request pipeline (temp directory + SaveTransientRequest flow); no new IPC, no schema changes. Related: usebruno#184
The menu item is already disabled when currentTabItem/isRequestTab is falsy, but mirrors the defensive pattern used elsewhere in this file (e.g. the currentTabUid guard) and prevents a theoretical NPE if state desyncs between render and click. Per CodeRabbit review on usebruno#7945.
Replaces an inline list of request types with the canonical isItemARequest helper. Avoids drift if new request types are added and matches how the rest of the codebase classifies items. Per Copilot review on usebruno#7945.
ecd1cfe to
90b5d61
Compare
Description
Adds a "Duplicate as Tab" option to the request tab right-click menu, mirroring Postman's "Duplicate Tab" idiom.
The existing Clone Request action requires a name in a modal and persists immediately to disk — well-suited for committing a copy. This new option duplicates the request into the collection's temp directory as a transient (unsaved) tab, pre-seeded with the source request's full state (including any unsaved draft changes), and opens it in a new tab. The user only commits to a name and folder if they later choose to save via the existing transient-save flow.
Reuses Bruno's existing transient-request infrastructure (temp directory +
SaveTransientRequestmodal); no new IPC, no schema changes.Demo
Screen.Recording.2026-05-07.at.10.01.48.mov
Related: #184
Contribution Checklist:
Summary by CodeRabbit
New Features
Bug Fixes