@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
19 lines • 914 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const hooks_1 = require("../../store/hooks");
const chatSlice_1 = require("../../store/slices/chatSlice");
/**
* Returns the number of conversations that have at least one unread message.
* Initialized from the server on ChatProvider mount — accurate before the
* conversation list is ever loaded. Kept in sync via socket events.
*
* Note: when a new message arrives from a conversation not yet loaded into
* the conversation list (e.g. paginated out), only `useTotalUnreadCount` is
* bumped — this count is not adjusted for that edge case and re-syncs on
* the next ChatProvider mount.
*/
function useUnreadConversationCount() {
return (0, hooks_1.useReplykeSelector)(chatSlice_1.selectUnreadConversationCount) ?? 0;
}
exports.default = useUnreadConversationCount;
//# sourceMappingURL=useUnreadConversationCount.js.map