Conversation
WalkthroughThe PR consolidates collection import flows across multiple sidebar and workspace components by introducing a unified Changes
Sequence DiagramsequenceDiagram
participant User
participant Component as Import Handler<br/>(CollectionsSection/SidebarHeader/<br/>WorkspaceOverview)
participant Modal as ImportCollectionLocation<br/>Modal
participant Redux as Redux Store<br/>(Workspace/Collections)
participant Action as Collection Actions
User->>Component: Trigger import
Component->>Modal: Store importData, open modal
activate Modal
Note over Modal: Derive defaultLocation from Redux<br/>(activeWorkspace, preferences)
Modal->>User: Display location picker
User->>Modal: Select location
deactivate Modal
Modal->>Action: Dispatch importCollection(data, location)
Action->>Redux: Process import with location
Redux-->>Component: Success/Error response
Component->>User: Show toast (success/error)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ 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: 0
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Sidebar/SidebarHeader/index.js (1)
51-55: Unified import flow looks good; consider clearingimportDataon modal closeThe new pattern of closing the first modal, storing
{ rawData, type }, and openingImportCollectionLocationis consistent with the rest of the app and keeps the import pipeline centralized.One small cleanup:
onCloseforImportCollectionLocationonly flipsimportCollectionLocationModalOpenand leavesimportDataset. It’s harmless (the modal condition checks both), but clearingimportDataon close would avoid stale state hanging around and more closely model “cancel” as abandoning the import.For example:
- {importCollectionLocationModalOpen && importData && ( + {importCollectionLocationModalOpen && importData && ( <ImportCollectionLocation rawData={importData.rawData} format={importData.type} - onClose={() => setImportCollectionLocationModalOpen(false)} + onClose={() => { + setImportCollectionLocationModalOpen(false); + setImportData(null); + }} handleSubmit={handleImportCollectionLocation} /> )}Also applies to: 156-162
packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js (1)
4-9: Import flow is correctly centralized; consider reusing logic and harmonizing errorsThe new 2‑step import flow here (store
{ rawData, type }, openImportCollectionLocation, then dispatchimportCollectionwith the converted data and chosen location) matches the sidebar components and looks functionally correct. State cleanup on success (setImportCollectionLocationModalOpen(false)+setImportData(null)) is also spot on.Two small follow‑ups you might consider:
Shared import helper
The pattern(importData state + ImportCollection + ImportCollectionLocation + handleImportCollectionLocation)is now duplicated across SidebarHeader, CollectionsSection, and WorkspaceOverview. Extracting a small hook or helper could reduce repetition and keep future changes to the import pipeline in one place.Consistent error messaging
Here you toasterr.message, while the sidebar flows use a generic'An error occurred while importing the collection'. Aligning on one approach (generic message + console log, or a safe parsed message) would give a more consistent UX.Also applies to: 19-21, 53-70, 85-92
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js(2 hunks)packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js(1 hunks)packages/bruno-app/src/components/Sidebar/SidebarHeader/index.js(1 hunks)packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions.() => {}is good
No space between function name and parentheses.func()notfunc ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly
Files:
packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.jspackages/bruno-app/src/components/Sidebar/SidebarHeader/index.jspackages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.jspackages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: CLI Tests
- GitHub Check: Playwright E2E Tests
- GitHub Check: Unit Tests
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - macOS
- GitHub Check: SSL Tests - Windows
🔇 Additional comments (2)
packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js (1)
45-49: Import flow wiring is consistent and correctClosing the initial import modal, storing
{ rawData, type }inimportData, and then openingImportCollectionLocationmatches the SidebarHeader flow and keeps behavior consistent across entry points. The guardimportCollectionLocationModalOpen && importDataalso prevents rendering with incomplete state.Also applies to: 226-232
packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js (1)
2-6: Default collection location logic looks solid; please QA across workspace scenariosThe new logic to derive
defaultLocationfrom Redux state is reasonable:
- Default workspace → falls back to
preferences.general.defaultCollectionLocation(viaget, so it’s safe ifpreferencesis missing).- Non‑default workspace → uses
${activeWorkspace.pathname}/collectionswhen available, otherwise empty string.- Formik now seeds
collectionLocationwith this computed value, which should address inconsistencies between default vs workspace‑specific imports.Given this is now the single source for all import entry points, it’s worth a quick QA pass to confirm:
- Default workspace with and without a configured
defaultCollectionLocation- Non‑default workspace with valid
pathname- Edge case where the active workspace changes while the modal is open
Also applies to: 92-100, 103-107
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.