Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(000): fix lint for account-list-item-menu and token-allowance #21094

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useRef, useEffect } from 'react';
import React, { useContext, useRef, useEffect, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
Expand Down Expand Up @@ -81,38 +81,45 @@ export const AccountListItemMenu = ({
} else {
lastItemRef.current = accountDetailsItemRef.current;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
removeJWTItemRef.current,
removeAccountItemRef.current,
accountDetailsItemRef.current,
]);

const handleKeyDown = (event) => {
if (event.key === 'Tab' && event.target === lastItemRef.current) {
// If Tab is pressed at the last item to close popover and focus to next element in DOM
onClose();
}
};
const handleKeyDown = useCallback(
(event) => {
if (event.key === 'Tab' && event.target === lastItemRef.current) {
// If Tab is pressed at the last item to close popover and focus to next element in DOM
onClose();
}
},
[onClose],
);

// Handle click outside of the popover to close it
const popoverDialogRef = useRef(null);

const handleClickOutside = (event) => {
if (
popoverDialogRef?.current &&
!popoverDialogRef.current.contains(event.target)
) {
onClose();
}
};
const handleClickOutside = useCallback(
(event) => {
if (
popoverDialogRef?.current &&
!popoverDialogRef.current.contains(event.target)
) {
onClose();
}
},
[onClose],
);

useEffect(() => {
document.addEventListener('mousedown', handleClickOutside);

return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, []);
}, [handleClickOutside]);

return (
<Popover
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/swaps/prepare-swap-page/prepare-swap-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ export default function PrepareSwapPage({
dispatch(resetSwapsPostFetchState());
dispatch(setReviewSwapClickedTimestamp());
trackPrepareSwapPageLoadedEvent();
}, [dispatch]);
}, [dispatch, trackPrepareSwapPageLoadedEvent]);

const BlockExplorerLink = () => {
return (
Expand Down
Loading