fix: sample collection creation race condition#7665
Conversation
WalkthroughModified IPC event timing in the onboarding flow to align sample collection delivery with workspace readiness. Changed from listening to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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📝 Generate docstrings
🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-electron/src/app/onboarding.js (1)
99-101:⚠️ Potential issue | 🟡 MinorStale comment references old event name.
Line 100 still says "deferred until main:renderer-ready is emitted" but the code now waits for
main:workspaces-ready.Proposed fix
// Store collection info to open after renderer is ready - // The main:collection-opened event is deferred until main:renderer-ready is emitted + // The main:collection-opened event is deferred until main:workspaces-ready is emitted pendingSampleCollection = { mainWindow, ...collectionInfo };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/app/onboarding.js` around lines 99 - 101, Update the stale comment above the pendingSampleCollection assignment to reference the new event name: replace mention of "main:renderer-ready" with "main:workspaces-ready" so it accurately reflects when the main:collection-opened event is deferred; confirm the comment sits next to the pendingSampleCollection variable and mentions both main:collection-opened and main:workspaces-ready for clarity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/bruno-electron/src/app/onboarding.js`:
- Around line 99-101: Update the stale comment above the pendingSampleCollection
assignment to reference the new event name: replace mention of
"main:renderer-ready" with "main:workspaces-ready" so it accurately reflects
when the main:collection-opened event is deferred; confirm the comment sits next
to the pendingSampleCollection variable and mentions both main:collection-opened
and main:workspaces-ready for clarity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a7b30559-b6c9-4b54-9311-e3523d3adb89
📒 Files selected for processing (2)
packages/bruno-electron/src/app/onboarding.jspackages/bruno-electron/src/ipc/workspace.js
Description
Fixes a race condition.
The sidebar filters collections to only show those belonging to the active workspace.
This PR guarantees the sample collection's main:collection-opened event is sent to the renderer only after the default workspace exists, so openCollectionEvent can properly associate the collection with the workspace and the sidebar filter will include it.
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
Bug Fixes