Skip to content

fix: update clone collection location logic based on active workspace#6841

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:fix/clone-location
Jan 20, 2026
Merged

fix: update clone collection location logic based on active workspace#6841
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:fix/clone-location

Conversation

@naman-bruno
Copy link
Collaborator

@naman-bruno naman-bruno commented Jan 18, 2026

Description

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.

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

  • Bug Fixes
    • Enhanced collection cloning to intelligently determine the default save location based on active workspace context, ensuring improved consistency with user workspace preferences.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Walkthrough

This 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 /collections appended.

Changes

Cohort / File(s) Summary
Clone Collection Workspace Awareness
packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js
Added workspace selectors and conditional logic to compute default location based on active workspace type; location defaults to user preference for default workspace, otherwise derives from active workspace pathname

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #6434 — Aligns with workspace-aware collection behavior changes in Sidebar, filtering collections and scoping operations to the active workspace context

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

🎨 A workspace whisper guides the clone—
📍 Default knows its home,
Custom paths emerge, no longer lone,
Collections roam where workspaces own! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: updating clone collection location logic based on active workspace, which directly matches the changeset.
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 docstrings

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.


const defaultLocation = isDefaultWorkspace
? get(preferences, 'general.defaultCollectionLocation', '')
: (activeWorkspace?.pathname ? `${activeWorkspace.pathname}/collections` : '');
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

@bijin-bruno bijin-bruno merged commit 9ab1ed3 into usebruno:main Jan 20, 2026
8 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