diff --git a/src/app/features/settings/account/Profile.tsx b/src/app/features/settings/account/Profile.tsx index 2cf6d501f..bc61b088e 100644 --- a/src/app/features/settings/account/Profile.tsx +++ b/src/app/features/settings/account/Profile.tsx @@ -365,17 +365,16 @@ function ProfileStatus() { useEffect(() => { if (!expiryTs) return undefined; const remaining = expiryTs - Date.now(); - if (remaining <= 0) { + const clearStatus = () => { localStorage.removeItem(STATUS_EXPIRY_KEY(userId)); setExpiryTs(0); - mx.setPresence({ presence: 'online', status_msg: '' }); + mx.setPresence({ presence: 'online', status_msg: '' }).catch(() => undefined); + }; + if (remaining <= 0) { + clearStatus(); return undefined; } - const timer = window.setTimeout(() => { - localStorage.removeItem(STATUS_EXPIRY_KEY(userId)); - setExpiryTs(0); - mx.setPresence({ presence: 'online', status_msg: '' }); - }, remaining); + const timer = window.setTimeout(clearStatus, remaining); return () => clearTimeout(timer); }, [expiryTs, userId, mx]); @@ -421,7 +420,7 @@ function ProfileStatus() { setStatusMsg(''); localStorage.removeItem(STATUS_EXPIRY_KEY(userId)); setExpiryTs(0); - mx.setPresence({ presence: 'online', status_msg: '' }); + mx.setPresence({ presence: 'online', status_msg: '' }).catch(() => undefined); }; const hasChanges = statusMsg !== (presence?.status ?? ''); @@ -440,7 +439,7 @@ function ProfileStatus() { } > - + }> - setEmojiAnchor(undefined)} - /> - - } - > - ) => { - const rect = evt.currentTarget.getBoundingClientRect(); - setEmojiAnchor((prev) => (prev ? undefined : rect)); - }} - > - - - - } /> + }> + setEmojiAnchor(undefined)} + /> + + } + > + ) => { + const rect = evt.currentTarget.getBoundingClientRect(); + setEmojiAnchor((prev) => (prev ? undefined : rect)); + }} + > + + +