N
Novu2mo ago
Shri

useNewMessagesCount hook from CountProvider is not exposed

Hey folks! I can see Novu React components using the useNewMessagesCount hook from the CountProvider but it doesnt look like its exposed for us to use. Which means we cannot create the same "1 new notification" button in our custom inbox. If it is actually exposed can you please share how to import it and get the count? Any reason why these very useful set of hooks and the provider is not exposed and documented? https://github.com/novuhq/novu/blob/031881a51b24602695675811face304754ece0d0/packages/js/src/ui/components/Notification/NotificationList.tsx https://github.com/novuhq/novu/blob/031881a51b24602695675811face304754ece0d0/packages/js/src/ui/context/CountContext.tsx
3 Replies
Dima Grossman
Dima Grossman2mo ago
@Shri did you had a chance of taking a look at: https://docs.novu.co/inbox/react/hooks/use-counts I believe it can be used for your particular usecase
Shri
ShriOP2mo ago
Hey! Thank you, Im using something like this and its working for now:
const { counts: unreadCounts } = useCounts({ filters: [{ read: false }] })
const { counts: archivedCounts } = useCounts({ filters: [{ archived: true }] })
const { counts: unreadCounts } = useCounts({ filters: [{ read: false }] })
const { counts: archivedCounts } = useCounts({ filters: [{ archived: true }] })
Hey @Dima Grossman I have another issue now after implementing my own custom Bell and Notifications component. When using an iPhone, if I switch from Safari to some other app for a while, change the total number of unread messages and then reopen Safari the bell shows the wrong unread message count. Is there a way to re-establish the WS connection after resuming the page from suspend?
Dima Grossman
Dima Grossman2mo ago
Checking this with the team 🙏
Want results from more Discord servers?
Add your server