Remove unread message dot when messages all read

Clicking the Mark All Read button was clearing the messages, but
the purple dot was not disappearing until the page was refreshed.
It appears it was just because the calculation was being cached
and not updated because the dm interaction counter was not inputted
as a dependency to useMemo
This commit is contained in:
w3irdrobot 2023-02-24 16:41:36 -05:00
parent d74af4b323
commit c0d9399ca7
Signed by: w3irdrobot
GPG Key ID: 3E6DBBB622F3155C

View File

@ -29,8 +29,17 @@ export default function Layout() {
const [show, setShow] = useState(false);
const dispatch = useDispatch();
const navigate = useNavigate();
const { loggedOut, publicKey, relays, latestNotification, readNotifications, dms, preferences, newUserKey } =
useSelector((s: RootState) => s.login);
const {
loggedOut,
publicKey,
relays,
latestNotification,
readNotifications,
dms,
preferences,
newUserKey,
dmInteraction,
} = useSelector((s: RootState) => s.login);
const { isMuted } = useModeration();
const [pageClass, setPageClass] = useState("page");
const pub = useEventPublisher();
@ -66,7 +75,7 @@ export default function Layout() {
publicKey
)
: 0,
[dms, publicKey]
[dms, publicKey, dmInteraction]
);
useEffect(() => {