fix: update clone collection location logic based on active workspace#6841
fix: update clone collection location logic based on active workspace#6841bijin-bruno merged 1 commit intousebruno:mainfrom
Conversation
WalkthroughThis change adds workspace-aware logic to the collection cloning feature, using the active workspace context to determine the default destination location. When cloning collections in a default workspace, the configured user preference applies; otherwise, the destination uses the active workspace's pathname with Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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
🤖 Fix all issues with AI agents
In
`@packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js`:
- Around line 23-30: activeWorkspace can be undefined on first render so change
the logic that computes isDefaultWorkspace and defaultLocation to treat a
missing activeWorkspace as the default workspace (matching the
ImportCollectionLocation pattern): compute isDefaultWorkspace as
(!activeWorkspace || activeWorkspace.type === 'default') and then derive
defaultLocation using that flag (use
preferences.general.defaultCollectionLocation when default, otherwise use
activeWorkspace.pathname + '/collections' if pathname exists), ensuring
defaultLocation never becomes an empty string and satisfies the form validation.
packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js
Show resolved
Hide resolved
|
|
||
| const defaultLocation = isDefaultWorkspace | ||
| ? get(preferences, 'general.defaultCollectionLocation', '') | ||
| : (activeWorkspace?.pathname ? `${activeWorkspace.pathname}/collections` : ''); |
There was a problem hiding this comment.
Setting the default collection location as workspace/collection location is contradictory with the idea of preferences. I think we should do this only when default location is not set in preferences.
Would like to discuss once with Product team before merging this PR.
Description
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
Please see here for more information.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.