From d0d41d0875ee20551c0f87ec9990b5a6247bcbe0 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:21:21 +0100 Subject: [PATCH] Profile: Update user status once per minute (#5474) --- src/components/common/ProfileInfo.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/common/ProfileInfo.tsx b/src/components/common/ProfileInfo.tsx index ad7c6e12c..927b3db6d 100644 --- a/src/components/common/ProfileInfo.tsx +++ b/src/components/common/ProfileInfo.tsx @@ -26,6 +26,7 @@ import { MEMO_EMPTY_ARRAY } from '../../util/memo'; import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import renderText from './helpers/renderText'; +import useIntervalForceUpdate from '../../hooks/schedulers/useIntervalForceUpdate'; import useLastCallback from '../../hooks/useLastCallback'; import useOldLang from '../../hooks/useOldLang'; import usePreviousDeprecated from '../../hooks/usePreviousDeprecated'; @@ -63,6 +64,7 @@ const EMOJI_STATUS_SIZE = 24; const EMOJI_TOPIC_SIZE = 120; const LOAD_MORE_THRESHOLD = 3; const MAX_PHOTO_DASH_COUNT = 30; +const STATUS_UPDATE_INTERVAL = 1000 * 60; // 1 min const ProfileInfo: FC = ({ forceShowSelf, @@ -88,6 +90,8 @@ const ProfileInfo: FC = ({ const lang = useOldLang(); + useIntervalForceUpdate(user ? STATUS_UPDATE_INTERVAL : undefined); + const photos = profilePhotos?.photos || MEMO_EMPTY_ARRAY; const prevMediaIndex = usePreviousDeprecated(mediaIndex); const prevAvatarOwnerId = usePreviousDeprecated(avatarOwnerId);