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 3f3dd30
Show file tree
Hide file tree
Showing 5 changed files with 21 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
1 change: 1 addition & 0 deletions src/components/TransactionsTab/TransactionsTab.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const NoTransactions = styled(motion.div)`
display: flex;
flex-direction: column;
align-items: center;
margin-block-start: 1rem;
height: 4.5rem;
color: ${(props) => props.theme.colors.lightGrey};
`;
Expand Down

0 comments on commit 3f3dd30

Please sign in to comment.