hide dropdown closing saved and all tabs

This commit is contained in:
Ricardo Silverio 2024-09-29 10:20:29 -03:00
parent e5c718f9f7
commit 453dc4d6dc

View File

@ -257,24 +257,24 @@ function RequestTabMenu({ onDropdownCreate, onCloseTabs, collectionRequestTabs,
} }
function handleCloseOtherTabs(event) { function handleCloseOtherTabs(event) {
dropdownTippyRef.current.hide();
event.stopPropagation(); event.stopPropagation();
dropdownTippyRef.current.hide();
const otherTabs = collectionRequestTabs.filter((_, index) => index !== tabIndex); const otherTabs = collectionRequestTabs.filter((_, index) => index !== tabIndex);
onCloseTabs(otherTabs.map((tab) => tab.uid)); onCloseTabs(otherTabs.map((tab) => tab.uid));
} }
function handleCloseTabsToTheLeft(event) { function handleCloseTabsToTheLeft(event) {
dropdownTippyRef.current.hide();
event.stopPropagation(); event.stopPropagation();
dropdownTippyRef.current.hide();
const leftTabs = collectionRequestTabs.filter((_, index) => index < tabIndex); const leftTabs = collectionRequestTabs.filter((_, index) => index < tabIndex);
onCloseTabs(leftTabs.map((tab) => tab.uid)); onCloseTabs(leftTabs.map((tab) => tab.uid));
} }
function handleCloseTabsToTheRight(event) { function handleCloseTabsToTheRight(event) {
dropdownTippyRef.current.hide();
event.stopPropagation(); event.stopPropagation();
dropdownTippyRef.current.hide();
const rightTabs = collectionRequestTabs.filter((_, index) => index > tabIndex); const rightTabs = collectionRequestTabs.filter((_, index) => index > tabIndex);
onCloseTabs(rightTabs.map((tab) => tab.uid)); onCloseTabs(rightTabs.map((tab) => tab.uid));
@ -282,6 +282,7 @@ function RequestTabMenu({ onDropdownCreate, onCloseTabs, collectionRequestTabs,
function handleCloseSavedTabs(event) { function handleCloseSavedTabs(event) {
event.stopPropagation(); event.stopPropagation();
dropdownTippyRef.current.hide();
const items = flattenItems(collection?.items); const items = flattenItems(collection?.items);
const savedTabs = items?.filter?.((item) => !item.draft); const savedTabs = items?.filter?.((item) => !item.draft);
@ -291,6 +292,7 @@ function RequestTabMenu({ onDropdownCreate, onCloseTabs, collectionRequestTabs,
function handleCloseAllTabs(event) { function handleCloseAllTabs(event) {
event.stopPropagation(); event.stopPropagation();
dropdownTippyRef.current.hide();
onCloseTabs(collectionRequestTabs.map((tab) => tab.uid)); onCloseTabs(collectionRequestTabs.map((tab) => tab.uid));
} }