Fix useUnreadNotifications exploding with falsey room, like in notif panel (#10030)

This commit is contained in:
Michael Telatynski 2023-01-31 12:38:25 +00:00 committed by GitHub
parent e2af97c4de
commit 262c2fcff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View file

@ -19,11 +19,11 @@ import { useCallback, useEffect, useState } from "react";
import type { NotificationCount, Room } from "matrix-js-sdk/src/models/room";
import { determineUnreadState } from "../RoomNotifs";
import type { NotificationColor } from "../stores/notifications/NotificationColor";
import { NotificationColor } from "../stores/notifications/NotificationColor";
import { useEventEmitter } from "./useEventEmitter";
export const useUnreadNotifications = (
room: Room,
room?: Room,
threadId?: string,
): {
symbol: string | null;
@ -32,7 +32,7 @@ export const useUnreadNotifications = (
} => {
const [symbol, setSymbol] = useState<string | null>(null);
const [count, setCount] = useState<number>(0);
const [color, setColor] = useState<NotificationColor>(0);
const [color, setColor] = useState<NotificationColor>(NotificationColor.None);
useEventEmitter(
room,