Skip to content

Commit

Permalink
955: Fixed cleanup bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
makkelie-dev committed Oct 24, 2024
1 parent 89c9e96 commit d941419
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
9 changes: 8 additions & 1 deletion src/components/@widgets/MakeWidget/MakeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ const MakeWidget: FC = () => {
const isNetworkSupported = useNetworkSupported();

// Modal states
const { setShowWalletList } = useContext(InterfaceContext);
const { setShowWalletList, transactionsTabIsOpen } =
useContext(InterfaceContext);
const [showOrderTypeInfo, toggleShowOrderTypeInfo] = useToggle(false);
const [showFeeInfo, toggleShowFeeInfo] = useToggle(false);
const [showTokenSelectModal, setShowTokenSelectModal] =
Expand All @@ -176,6 +177,12 @@ const MakeWidget: FC = () => {
dispatch(reset());
}, []);

useEffect(() => {
if (transactionsTabIsOpen) {
setShowTokenSelectModal(null);
}
}, [transactionsTabIsOpen]);

useEffect(() => {
if (library) {
dispatch(fetchIndexerUrls({ provider: library }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ const MyOrdersList: FC<MyOrdersListProps> = ({
handleOnContainerScroll.bind(this)
);

return containerRef.current?.removeEventListener(
"scroll",
handleOnContainerScroll.bind(this)
);
return () => {
containerRef.current?.removeEventListener(
"scroll",
handleOnContainerScroll.bind(this)
);
};
}, [containerRef]);

useEffect(() => {
Expand Down
6 changes: 6 additions & 0 deletions src/components/@widgets/SwapWidget/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ const SwapWidget: FC = () => {
baseTokenInfo?.address === ADDRESS_ZERO &&
!!nativeCurrencySafeTransactionFee[baseTokenInfo.chainId];

useEffect(() => {
if (transactionsTabIsOpen) {
setShowTokenSelectModalFor(null);
}
}, [transactionsTabIsOpen]);

useEffect(() => {
setTokenFrom(appRouteParams.tokenFrom);
setTokenTo(appRouteParams.tokenTo);
Expand Down
6 changes: 0 additions & 6 deletions src/components/Overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ const Overlay: FC<OverlayProps> = ({
[isHidden]
);

useEffect(() => {
if (transactionsTabIsOpen && !isHidden) {
onClose();
}
}, [transactionsTabIsOpen]);

return (
<Container
ref={ref}
Expand Down

0 comments on commit d941419

Please sign in to comment.