From 584344ac47325513e674e1f73af22680694751f2 Mon Sep 17 00:00:00 2001 From: sanish chirayath Date: Wed, 28 Jan 2026 17:59:03 +0530 Subject: [PATCH] Fix: duplicate toast when saving an example (#6952) * chore: update saveRequest calls from example to include silent parameter - Modified multiple components to pass an additional `true` parameter to the `saveRequest` function, ensuring requests are saved silently when it comes to examples. - Added AGENTS.md to .gitignore to exclude it from version control. * feat: add success notifications for cloning, renaming and deleting examples * refactor: update saveRequest calls to handle success notifications for renaming and deleting examples * refactor: remove unused toast import from DeleteResponseExampleModal --- .gitignore | 1 + .../src/components/RequestTabs/ExampleTab/index.js | 2 +- .../components/ResponsePane/ResponseBookmark/index.js | 2 +- .../ExampleItem/DeleteResponseExampleModal/index.js | 6 ++++-- .../Collection/CollectionItem/ExampleItem/index.js | 9 ++++++--- .../Collections/Collection/CollectionItem/index.js | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index fb650b306..808df3dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ bruno.iml # Development plan files CLAUDE.md +AGENTS.md *.plan.md # packages dist diff --git a/packages/bruno-app/src/components/RequestTabs/ExampleTab/index.js b/packages/bruno-app/src/components/RequestTabs/ExampleTab/index.js index 3ff462f95..6cf429b2c 100644 --- a/packages/bruno-app/src/components/RequestTabs/ExampleTab/index.js +++ b/packages/bruno-app/src/components/RequestTabs/ExampleTab/index.js @@ -93,7 +93,7 @@ const ExampleTab = ({ tab, collection }) => { onSaveAndClose={() => { // For examples, we don't have a separate save action // The changes are saved automatically when the request is saved - dispatch(saveRequest(item.uid, collection.uid)); + dispatch(saveRequest(item.uid, collection.uid, true)); dispatch(closeTabs({ tabUids: [tab.uid] })); diff --git a/packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js b/packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js index 909a129cb..c60574509 100644 --- a/packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js +++ b/packages/bruno-app/src/components/ResponsePane/ResponseBookmark/index.js @@ -112,7 +112,7 @@ const ResponseBookmark = forwardRef(({ item, collection, responseSize, children })); // Save the request - await dispatch(saveRequest(item.uid, collection.uid)); + await dispatch(saveRequest(item.uid, collection.uid, true)); // Task middleware will track this and open the example in a new tab once the file is reloaded dispatch(insertTaskIntoQueue({ diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/DeleteResponseExampleModal/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/DeleteResponseExampleModal/index.js index e5a1350f7..58078433a 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/DeleteResponseExampleModal/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/DeleteResponseExampleModal/index.js @@ -17,8 +17,10 @@ const DeleteResponseExampleModal = ({ onClose, example, item, collection }) => { collectionUid: collection.uid, exampleUid: example.uid })); - dispatch(saveRequest(item.uid, collection.uid)); - onClose(); + dispatch(saveRequest(item.uid, collection.uid, true)) + .then(() => { + onClose(); + }); }; return ( diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/index.js index bae6621e2..fe214a384 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/ExampleItem/index.js @@ -86,7 +86,7 @@ const ExampleItem = ({ example, item, collection }) => { })); // Save the request - await dispatch(saveRequest(item.uid, collection.uid)); + await dispatch(saveRequest(item.uid, collection.uid, true)); // Task middleware will track this and open the example in a new tab once the file is reloaded dispatch(insertTaskIntoQueue({ @@ -125,8 +125,11 @@ const ExampleItem = ({ example, item, collection }) => { name: newName } })); - dispatch(saveRequest(item.uid, collection.uid)); - setShowRenameModal(false); + dispatch(saveRequest(item.uid, collection.uid, true)) + .then(() => { + toast.success(`Example renamed to "${newName}"`); + setShowRenameModal(false); + }); }; // Build menu items for MenuDropdown diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index e3f4e78c8..91f54d50a 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -487,7 +487,7 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText }) })); // Save the request - await dispatch(saveRequest(item.uid, collectionUid)); + await dispatch(saveRequest(item.uid, collectionUid, true)); // Task middleware will track this and open the example in a new tab once the file is reloaded dispatch(insertTaskIntoQueue({