fix: addresses feedback

pull/3216/head
wafflesvsfrankie 5 months ago
parent 78935dacdf
commit 61c91be91c

@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import useInterval from 'react-use/lib/useInterval'; import useInterval from 'react-use/lib/useInterval';
import useTimeoutFn from 'react-use/lib/useTimeoutFn'; import useTimeoutFn from 'react-use/lib/useTimeoutFn';
import { useThrottleFn } from 'react-use';
import { Data } from '../../data/data'; import { Data } from '../../data/data';
import { getConversationController } from '../../session/conversations'; import { getConversationController } from '../../session/conversations';
@ -243,11 +244,15 @@ export const ActionsPanel = () => {
const unreadToShow = globalUnreadMessageCount; const unreadToShow = globalUnreadMessageCount;
// Reuse the unreadToShow from the global state to update the badge count // Reuse the unreadToShow from the global state to update the badge count
useEffect(() => { useThrottleFn(
if (unreadToShow !== undefined) { () => {
ipcRenderer.send('update-badge-count', unreadToShow); if (unreadToShow !== undefined) {
} ipcRenderer.send('update-badge-count', unreadToShow);
}, [unreadToShow]); }
},
2000,
[]
);
useInterval(cleanUpOldDecryptedMedias, startCleanUpMedia ? cleanUpMediasInterval : null); useInterval(cleanUpOldDecryptedMedias, startCleanUpMedia ? cleanUpMediasInterval : null);

@ -306,9 +306,7 @@ const _getContacts = (
}); });
}; };
export const _getGlobalUnreadCount = ( const _getGlobalUnreadCount = (sortedConversations: Array<ReduxConversationType>): number => {
sortedConversations: Array<ReduxConversationType>
): number => {
let globalUnreadCount = 0; let globalUnreadCount = 0;
for (const conversation of sortedConversations) { for (const conversation of sortedConversations) {
// Blocked conversation are now only visible from the settings, not in the conversation list, so don't add it neither to the contacts list nor the conversation list // Blocked conversation are now only visible from the settings, not in the conversation list, so don't add it neither to the contacts list nor the conversation list

Loading…
Cancel
Save