Skip to content

Commit

Permalink
refetch all subscriptions added (#1810)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 authored Aug 16, 2024
1 parent 19451df commit 0e38437
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/modules/dashboard/components/FeaturedChannelsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ import { useAccount } from 'hooks';
import { formatSubscriberCount } from '../Dashboard.utils';

// Components
import { Box, Button, CaretDown, Ethereum, NotificationMobile, Skeleton, Text, TickDecoratedCircleFilled } from 'blocks';
import {
Box,
Button,
CaretDown,
Ethereum,
NotificationMobile,
Skeleton,
Text,
TickDecoratedCircleFilled,
} from 'blocks';
import { SubscribeChannelDropdown } from 'common/components/SubscribeChannelDropdown';
import { UnsubscribeChannelDropdown } from 'common/components/UnsubscribeChannelDropdown';
import { VerifiedToolTipComponent } from './VerifiedToolTipComponent';
Expand All @@ -37,7 +46,7 @@ const FeaturedChannelsListItem: FC<FeaturedChannelsListItemProps> = (props) => {

/* Fetching Channel Details based on Channel Address */
const { data: channelDetails, isLoading } = useGetChannelDetails(channelAddress);

const { refetch: refetchAllSubscriptions } = useGetUserSubscriptions();
/* Fetching User Subscribed Channel Details along with user settings */
const {
data: userSubscription,
Expand All @@ -52,6 +61,10 @@ const FeaturedChannelsListItem: FC<FeaturedChannelsListItemProps> = (props) => {
const hasAliasAddress =
channelDetails && channelDetails?.alias_address != null && channelDetails?.alias_address != 'NULL';

const handleRefetch = () => {
refetch();
refetchAllSubscriptions();
};
return (
<>
<Box
Expand Down Expand Up @@ -87,7 +100,7 @@ const FeaturedChannelsListItem: FC<FeaturedChannelsListItemProps> = (props) => {
>
<SubscribeChannelDropdown
channelDetails={channelDetails!}
onSuccess={refetch}
onSuccess={handleRefetch}
>
<Button
id="basic-button"
Expand All @@ -108,7 +121,7 @@ const FeaturedChannelsListItem: FC<FeaturedChannelsListItemProps> = (props) => {
>
<UnsubscribeChannelDropdown
channelDetail={channelDetails!}
onSuccess={refetch}
onSuccess={handleRefetch}
userSetting={JSON.parse(userSubscription[0].user_settings) as UserSetting[]}
>
<Button
Expand Down

0 comments on commit 0e38437

Please sign in to comment.