diff --git a/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx b/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx index 3707d112f..6508b8c3f 100644 --- a/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx +++ b/dapp/src/components/shared/ActivitiesList/ActivitiesList.tsx @@ -1,10 +1,8 @@ -import React, { useEffect } from "react" +import React from "react" import { List, ListItem, ListProps } from "@chakra-ui/react" import { AnimatePresence, Variants, motion } from "framer-motion" import { useActivitiesNEW as useActivities, useAppDispatch } from "#/hooks" import { deleteActivity } from "#/store/wallet" -import { useActivitiesIds } from "#/hooks/store" -import { ONE_SEC_IN_MILLISECONDS } from "#/constants" import ActivitiesListItem from "./ActivitiesListItem" const MotionList = motion(List) @@ -18,45 +16,34 @@ const listItemVariants: Variants = { function ActivitiesList(props: ListProps) { const dispatch = useAppDispatch() const activities = useActivities() - const activitiesIds = useActivitiesIds() - - const [allActivities, setAllActivities] = React.useState(activities) - - useEffect(() => { - setTimeout(() => { - setAllActivities(activities) - }, ONE_SEC_IN_MILLISECONDS) - }, [activities]) const handleItemDismiss = (activityId: string) => { dispatch(deleteActivity(activityId)) } - if (allActivities.length === 0) return null + if (activities.length === 0) return null return ( - {allActivities.map((item) => ( - - {activitiesIds.includes(item.id) && ( - - handleItemDismiss(item.id)} - /> - - )} - - ))} + + {activities.map((item) => ( + + handleItemDismiss(item.id)} + /> + + ))} + ) } diff --git a/dapp/src/hooks/store/index.ts b/dapp/src/hooks/store/index.ts index 8f6378bac..f0183c825 100644 --- a/dapp/src/hooks/store/index.ts +++ b/dapp/src/hooks/store/index.ts @@ -10,4 +10,3 @@ export * from "./useActionFlowTokenAmount" // TODO: Rename when the old hook is deleted. export { useActivities as useActivitiesNEW } from "./useActivities" export * from "./useTransactions" -export * from "./useActivitiesIds" diff --git a/dapp/src/hooks/store/useActivitiesIds.ts b/dapp/src/hooks/store/useActivitiesIds.ts deleted file mode 100644 index d417e42b0..000000000 --- a/dapp/src/hooks/store/useActivitiesIds.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { selectActivitiesIds } from "#/store/wallet" -import { useAppSelector } from "./useAppSelector" - -export function useActivitiesIds() { - return useAppSelector(selectActivitiesIds) -} diff --git a/dapp/src/store/wallet/walletSelector.ts b/dapp/src/store/wallet/walletSelector.ts index ea65be13b..ae691f010 100644 --- a/dapp/src/store/wallet/walletSelector.ts +++ b/dapp/src/store/wallet/walletSelector.ts @@ -7,10 +7,5 @@ export const selectActivities = createSelector( (activities) => Object.values(activities), ) -export const selectActivitiesIds = createSelector( - (state: RootState) => state.wallet.activities, - (activities) => Object.keys(activities), -) - export const selectTransactions = (state: RootState): Activity[] => state.wallet.transactions