Skip to content

bugfix: auto open saved transient request - #7058

Merged
sid-bruno merged 6 commits into
usebruno:mainfrom
chirag-bruno:bugfix/transient-request-on-save-should-persist-in-tab
Feb 6, 2026
Merged

sid-bruno merged 6 commits into
usebruno:mainfrom
chirag-bruno:bugfix/transient-request-on-save-should-persist-in-tab

Conversation

@chirag-bruno

@chirag-bruno chirag-bruno commented Feb 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When a request gets saved, auto open the request in a tab.

JIRA: https://usebruno.atlassian.net/browse/BRU-2615

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

  • New Features
    • Saved requests now open automatically after creation.
  • Chores
    • Improved save flow reliability so newly saved requests are detected and opened more consistently.
  • Behavior Change
    • New requests are opened with a non-preview tab by default (so they remain open for editing).

@coderabbitai

coderabbitai Bot commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

SaveTransientRequest now computes the target file pathname before saving and, after persisting the transient request via IPC, enqueues an OPEN_REQUEST task (with generated uid, collectionUid, and itemPathname) so the file-watcher can open the saved request automatically. (48 words)

Changes

Cohort / File(s) Summary
SaveTransientRequest
packages/bruno-app/src/components/SaveTransientRequest/index.js
Added imports (insertTaskIntoQueue, path, uuid). Compute targetPathname by joining directory and filename prior to IPC save. After save, dispatch OPEN_REQUEST task with generated uid, collectionUid, and itemPathname. Minor local refactor.
Task middleware
packages/bruno-app/src/providers/ReduxStore/middlewares/tasks/middleware.js
Changed OPEN_REQUEST handling to use task?.preview ?? true for tab preview state instead of deriving preview from isTransient. Removed local isTransient calculation for this path.
Collection actions (task enqueue points)
packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
Include explicit preview: false in OPEN_REQUEST tasks created by new request flows (newHttpRequest, newGrpcRequest, newWsRequest and transient/new-item paths).

Sequence Diagram(s)

sequenceDiagram
    participant UI as SaveTransientRequest (Renderer)
    participant IPC as IPCMain
    participant FS as FileSystem
    participant Queue as TaskQueue
    participant Watcher as FileWatcher

    UI->>IPC: saveTransientRequest(payload, targetPathname)
    IPC->>FS: write file at targetPathname
    FS-->>IPC: write success
    IPC-->>UI: save success
    UI->>Queue: insertTaskIntoQueue({ type: "OPEN_REQUEST", uid, collectionUid, itemPathname, preview })
    Queue-->>Watcher: task enqueued / watcher observes file change
    Watcher->>UI: open request when file detected
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno
  • sid-bruno

Poem

A pathname formed, a UID bestowed,
The IPC whispers, the file is sowed.
A task is queued, the watcher stirs,
From save to open, the UI purrs. ✨

🚥 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 'bugfix: auto open saved transient request' is a brief, direct summary that captures the main change in the PR—enabling automatic opening of saved transient requests in a tab.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@sid-bruno

Copy link
Copy Markdown
Collaborator
Screen.Recording.2026-02-06.at.12.36.52.PM.mov

Breaks for when there's more than one request.

…ntRequest and middleware

- Updated SaveTransientRequest component to include a preview property set to false when opening requests.
- Modified task middleware to use the preview property from the task, defaulting to true if not provided.
- Ensured consistency across newHttpRequest, newGrpcRequest, and newWsRequest actions by adding the preview property.
… of github.com:chirag-bruno/bruno into bugfix/transient-request-on-save-should-persist-in-tab

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/ReduxStore/middlewares/tasks/middleware.js (1)

27-50: ⚠️ Potential issue | 🟠 Major

Bug confirmed: tasks removed from queue regardless of whether target items are found.

Both task handlers exhibit the same pattern:

  1. OPEN_REQUEST (lines 44-48): removeTaskFromQueue is called outside the if (item) block, removing tasks even when the target pathname isn't found.

  2. OPEN_EXAMPLE (lines 87-89): Same issue—removeTaskFromQueue is called outside the nested conditions that verify the example exists, removing tasks even when item or example isn't found.

When multiple tasks target different items in the same collection, the first file event fires and removes all matching tasks by collectionUid, leaving orphaned tasks that will never be processed. This explains "breaks for when there's more than one request."

The proposed fix is correct: move removeTaskFromQueue inside the successful match condition for each handler. For OPEN_REQUEST, move it inside if (item) (line 32-41). For OPEN_EXAMPLE, move it inside if (example) (lines 75-83).

Note: Tasks that never find their target need eventual cleanup—consider adding a staleness/TTL mechanism or max-retry count to prevent unbounded queue growth.

🧹 Nitpick comments (1)
packages/bruno-app/src/components/SaveTransientRequest/index.js (1)

145-153: closeTabs is not awaited — verify this is intentional.

closeTabs is an async thunk (it deletes transient files from the filesystem). It's fire-and-forget here. Since the old transient file lives in the temp directory and the new file is in the target collection directory, ordering shouldn't matter. But if a future change moves the file instead of copying, the unawaited deletion could race with the file watcher.

Optional: await closeTabs for safety
-      dispatch(closeTabs({ tabUids: [item.uid] }));
+      await dispatch(closeTabs({ tabUids: [item.uid] }));

@sid-bruno
sid-bruno merged commit 1c5e1c5 into usebruno:main Feb 6, 2026
5 of 9 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 14, 2026
6 tasks
maxenceleblanc pushed a commit to maxenceleblanc/curly_cats2 that referenced this pull request Jul 20, 2026
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