feat: enhance SaveRequestsModal to handle environment drafts#6857
feat: enhance SaveRequestsModal to handle environment drafts#6857bijin-bruno merged 1 commit intousebruno:mainfrom
Conversation
WalkthroughExtends SaveRequestsModal to handle collection-specific and global environment drafts alongside existing request, folder, and collection drafts. Integrates environment persistence logic with corresponding UI labels and state tracking within the unsaved items workflow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js (1)
28-56: Avoid silently dropping environment drafts when lookup fails.
Both collection/global blocks only push drafts if the environment lookup succeeds. If the environment list hasn’t hydrated yet (or was renamed/removed), the draft is omitted, which can drivetotalDraftsCountto zero and auto-close the modal, discarding unsaved variables. Consider keeping the draft with a fallback name so the save path can still attempt persistence.✅ Suggested fix to preserve drafts even when the environment isn’t resolved
- if (collection.environmentsDraft) { - const { environmentUid, variables } = collection.environmentsDraft; - const environment = findEnvironmentInCollection(collection, environmentUid); - if (environment && variables) { - environmentDrafts.push({ - type: 'collection-environment', - name: environment.name, - environmentUid, - variables, - collectionUid: collectionUid - }); - } - } + if (collection.environmentsDraft) { + const { environmentUid, variables } = collection.environmentsDraft; + if (variables) { + const environment = findEnvironmentInCollection(collection, environmentUid); + environmentDrafts.push({ + type: 'collection-environment', + name: environment?.name || 'Unknown Environment', + environmentUid, + variables, + collectionUid: collectionUid + }); + } + }- if (globalEnvironmentDraft) { - const { environmentUid, variables } = globalEnvironmentDraft; - const environment = globalEnvironments?.find((env) => env.uid === environmentUid); - if (environment && variables) { - environmentDrafts.push({ - type: 'global-environment', - name: environment.name, - environmentUid, - variables - }); - } - } + if (globalEnvironmentDraft) { + const { environmentUid, variables } = globalEnvironmentDraft; + if (variables) { + const environment = globalEnvironments?.find((env) => env.uid === environmentUid); + environmentDrafts.push({ + type: 'global-environment', + name: environment?.name || 'Unknown Environment', + environmentUid, + variables + }); + } + }Also applies to: 84-95
Description
JIRA: https://usebruno.atlassian.net/browse/BRU-1150
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
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.