mirror of
https://github.com/Mail-0/Zero.git
synced 2026-07-01 08:16:28 +00:00
simplify getLabelCount function logic
This commit is contained in:
@@ -172,13 +172,9 @@ export function NavMain({ items }: NavMainProps) {
|
||||
[pathname, category, searchParams, isValidInternalUrl],
|
||||
);
|
||||
|
||||
const getLabelCount = React.useMemo(() => {
|
||||
if (!stats) return () => 0;
|
||||
|
||||
return (labelName: string | undefined) => {
|
||||
if (!labelName) return 0;
|
||||
return stats.find((stat) => stat.label?.toLowerCase() === labelName.toLowerCase())?.count ?? 0;
|
||||
};
|
||||
const getLabelCount = useCallback((labelName: string | undefined): number => {
|
||||
if (!stats || !labelName) return 0;
|
||||
return stats.find((stat) => stat.label?.toLowerCase() === labelName.toLowerCase())?.count ?? 0;
|
||||
}, [stats]);
|
||||
|
||||
const activeAccount = React.useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user