mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-18 18:59:23 +00:00
Use deferred value
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
|||||||
TouchEvent,
|
TouchEvent,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useDeferredValue,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
useRef,
|
useRef,
|
||||||
@@ -175,9 +176,11 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
onShareClick,
|
onShareClick,
|
||||||
}) => {
|
}) => {
|
||||||
const { supportsReactions, raisedHands } = useReactions();
|
const { supportsReactions, raisedHands } = useReactions();
|
||||||
const raisedHandCount = Object.keys(raisedHands).length;
|
const raisedHandCount = useMemo(
|
||||||
const [previousRaisedHandCount, setPreviousRaisedHandCount] =
|
() => Object.keys(raisedHands).length,
|
||||||
useState(raisedHandCount);
|
[raisedHands],
|
||||||
|
);
|
||||||
|
const previousRaisedHandCount = useDeferredValue(raisedHandCount);
|
||||||
|
|
||||||
useWakeLock();
|
useWakeLock();
|
||||||
|
|
||||||
@@ -320,7 +323,6 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
logger.warn("Failed to play raise hand sound", ex);
|
logger.warn("Failed to play raise hand sound", ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setPreviousRaisedHandCount(raisedHandCount);
|
|
||||||
}, [raisedHandCount, handRaisePlayer, previousRaisedHandCount]);
|
}, [raisedHandCount, handRaisePlayer, previousRaisedHandCount]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user