Skip to content

Commit

Permalink
moved default parameter (ToolJet#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
VilijaSan authored Oct 16, 2021
1 parent 78d0ce3 commit 02434ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/_hooks/use-popover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useEscapeHandler = (handler = noop, dependencies = []) => {
document === null || document === void 0 ? void 0 : document.removeEventListener('keyup', escapeHandler);
}, dependencies);
};
const useClickOutside = (handler = noop, dependencies) => {
const useClickOutside = (dependencies, handler = noop) => {
const callbackRef = useRef(handler);
const ref = useRef(null);
const outsideClickHandler = (e) => {
Expand Down Expand Up @@ -43,7 +43,7 @@ const usePopover = (defaultOpen = false) => {
const toggle = useCallback(() => setOpen(!open), []);
const close = useCallback(() => setOpen(false), []);
useEscapeHandler(close, []);
const contentRef = useClickOutside(open ? close : undefined, []);
const contentRef = useClickOutside([], open ? close : undefined);
const trigger = {
ref: triggerRef,
onClick: toggle,
Expand Down

0 comments on commit 02434ce

Please sign in to comment.