N
Novu14mo ago
Schyres

In-app notification: Unseen count for selected feeds

Hi all, I'm wondering if there's a way to get unseen notification counts for In-app notification of some feedId I found that using the SDK i could get the notification for some feeds ({ feedIdentifier: "feedA" }), however I tried using the codebox provided in the docs and it appears unseenCount counts for all notification to the subscriber, not being filtered by feedIdentifier I need to get the unseen count for some selected feed, e.g. having 3 feeds : - feedA with 2 unseen - feedB with 5 unseen - feedC with 1 unseen. I want to be able to query unseen count just for feedA and feedC , so that it would show 3 instead of accumulative 8 how can I do this? configuration: selfhosted novu @ v0.19.0 access to novu using react SDK
3 Replies
Pawan Jain
Pawan Jain14mo ago
Hi @Schyres did you try using useFecthNotifications hook?
Schyres
SchyresOP14mo ago
Hi @Pawan Jain, I tried looking for it but i can't find anything related to unseen count in the return type for status success,
{
refetch: <TPageData>({ page, ...otherOptions }?: {
page?: number;
} & import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) => void;
data: import("@tanstack/react-query").InfiniteData<IPaginatedResponse<IMessage>>;
error: null;
isError: false;
isLoading: false;
isLoadingError: false;
isRefetchError: false;
isSuccess: true;
status: "success";
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<IPaginatedResponse<IMessage>, Error>>;
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<IPaginatedResponse<IMessage>, Error>>;
hasNextPage?: boolean;
hasPreviousPage?: boolean;
isFetchingNextPage: boolean;
isFetchingPreviousPage: boolean;
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: Error;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
}
{
refetch: <TPageData>({ page, ...otherOptions }?: {
page?: number;
} & import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) => void;
data: import("@tanstack/react-query").InfiniteData<IPaginatedResponse<IMessage>>;
error: null;
isError: false;
isLoading: false;
isLoadingError: false;
isRefetchError: false;
isSuccess: true;
status: "success";
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<IPaginatedResponse<IMessage>, Error>>;
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<IPaginatedResponse<IMessage>, Error>>;
hasNextPage?: boolean;
hasPreviousPage?: boolean;
isFetchingNextPage: boolean;
isFetchingPreviousPage: boolean;
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: Error;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
}
Pawan Jain
Pawan Jain14mo ago
Hi @Schyres I see useFetchNotifications is missing this Can you please try this hook? https://docs.novu.co/notification-center/client/react/api-reference#usefeedunseencount
Want results from more Discord servers?
Add your server