mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 22:45:25 +00:00
fix(tests): flaky bound action e2e tests (#8071)
This commit is contained in:
@@ -127,6 +127,12 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
|
||||
return false;
|
||||
}, { enabled: isKeyboardFocused, deps: [isKeyboardFocused] });
|
||||
|
||||
useKeybinding('newRequest', () => {
|
||||
if (!isFolder) return false;
|
||||
setNewRequestModalOpen(true);
|
||||
return false;
|
||||
}, { enabled: isKeyboardFocused && isFolder, deps: [isKeyboardFocused, isFolder] });
|
||||
|
||||
const [dropType, setDropType] = useState(null); // 'adjacent' or 'inside'
|
||||
|
||||
const [{ isDragging }, drag, dragPreview] = useDrag({
|
||||
|
||||
@@ -228,6 +228,11 @@ const Collection = ({ collection, searchText }) => {
|
||||
return false;
|
||||
}, { enabled: isKeyboardFocused, deps: [isKeyboardFocused] });
|
||||
|
||||
useKeybinding('newRequest', () => {
|
||||
setShowNewRequestModal(true);
|
||||
return false;
|
||||
}, { enabled: isKeyboardFocused, deps: [isKeyboardFocused] });
|
||||
|
||||
const handleFocus = () => {
|
||||
setIsKeyboardFocused(true);
|
||||
dispatch(setFocusedSidebarPath(collection.pathname));
|
||||
|
||||
@@ -88,26 +88,6 @@ export const HotkeysProvider = (props) => {
|
||||
};
|
||||
}, [activeTabUid, tabs, collections, dispatch, userKeyBindings, keybindingsEnabled]);
|
||||
|
||||
// new request
|
||||
useEffect(() => {
|
||||
bindAction('newRequest', (e) => {
|
||||
const activeTab = find(tabs, (t) => t.uid === activeTabUid);
|
||||
if (activeTab) {
|
||||
const collection = findCollectionByUid(collections, activeTab.collectionUid);
|
||||
|
||||
if (collection) {
|
||||
setShowNewRequestModal(true);
|
||||
}
|
||||
}
|
||||
|
||||
return false; // this stops the event bubbling
|
||||
});
|
||||
|
||||
return () => {
|
||||
unbindAction('newRequest');
|
||||
};
|
||||
}, [activeTabUid, tabs, collections, setShowNewRequestModal, userKeyBindings, keybindingsEnabled]);
|
||||
|
||||
// global search
|
||||
useEffect(() => {
|
||||
bindAction('globalSearch', (e) => {
|
||||
|
||||
Reference in New Issue
Block a user