Skip to content

fix: duplicate toast when opening an already-opened collection#64

Open
chirag-bruno wants to merge 1 commit into
usebruno:mainfrom
chirag-bruno:fix/remove-duplicate-toast
Open

fix: duplicate toast when opening an already-opened collection#64
chirag-bruno wants to merge 1 commit into
usebruno:mainfrom
chirag-bruno:fix/remove-duplicate-toast

Conversation

@chirag-bruno

Copy link
Copy Markdown
Collaborator

Summary

  • Replace webview-broadcast toasts with native VS Code notifications for open collection messages

Problem

When opening an already-opened collection, the "Collection is already opened" toast appeared twice — once in the sidebar and once in the tab editor. Similarly, error messages like "The collection is not valid" showed in both places.

Root Cause

The openCollectionDialog and openCollection functions used messageSender (which broadcasts to ALL webviews) to send main:toast-success and main:display-error events. Every webview with a <Toaster> rendered the notification independently.

Solution

Replace messageSender('main:toast-success', ...) and messageSender('main:display-error', ...) with native vscode.window.showInformationMessage and vscode.window.showErrorMessage. These display a single notification in VS Code's notification area.

Test plan

  • Open an already-opened collection → verify single "Collection is already opened" notification
  • Open an invalid folder (no bruno.json/opencollection.yml) → verify single error notification
  • Open multiple invalid folders → verify single error listing them
  • TypeScript typecheck passes

The open collection flow broadcast toast/error messages to all webviews
via messageSender, causing the same notification to appear in both the
sidebar and every open tab editor.

Switch to native VS Code notifications (showInformationMessage,
showErrorMessage) which display a single notification regardless of
how many webviews are active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants