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

Synced subscribed channels with featured channels #1810

Merged
merged 1 commit into from
Aug 16, 2024
Merged
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
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
Loading