Skip to content

Commit 2f0aa24

Browse files
committed
fix: prevent unnecessary memoization of isBehindRefreshBoundary in ReminderNotification
1 parent 05ec453 commit 2f0aa24

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/components/Message/ReminderNotification.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo } from 'react';
1+
import React from 'react';
22
import { useChatContext, useTranslationContext } from '../../context';
33
import { useStateStore } from '../../store';
44
import type { Reminder, ReminderState } from 'stream-chat';
@@ -16,14 +16,14 @@ export const ReminderNotification = ({ reminder }: ReminderNotificationProps) =>
1616
const { t } = useTranslationContext();
1717
const { timeLeftMs } = useStateStore(reminder?.state, reminderStateSelector) ?? {};
1818

19-
const isBehindRefreshBoundary = useMemo(() => {
20-
const stopRefreshBoundaryMs = client.reminders.stopTimerRefreshBoundaryMs;
21-
const stopRefreshTimeStamp =
22-
reminder?.remindAt && stopRefreshBoundaryMs
23-
? reminder?.remindAt.getTime() + stopRefreshBoundaryMs
24-
: undefined;
25-
return !!stopRefreshTimeStamp && new Date().getTime() > stopRefreshTimeStamp;
26-
}, [client, reminder]);
19+
const stopRefreshBoundaryMs = client.reminders.stopTimerRefreshBoundaryMs;
20+
const stopRefreshTimeStamp =
21+
reminder?.remindAt && stopRefreshBoundaryMs
22+
? reminder?.remindAt.getTime() + stopRefreshBoundaryMs
23+
: undefined;
24+
25+
const isBehindRefreshBoundary =
26+
!!stopRefreshTimeStamp && new Date().getTime() > stopRefreshTimeStamp;
2727

2828
return (
2929
<p className='str-chat__message-reminder'>

0 commit comments

Comments
 (0)