Prefer RoomStateEvent.Update where possible as it fires far less (#7878)

This commit is contained in:
Michael Telatynski 2022-02-24 14:39:25 +00:00 committed by GitHub
parent 36ae0ea49d
commit c257bc3f7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 223 additions and 190 deletions

View file

@ -24,6 +24,7 @@ import {
PHASE_STARTED,
PHASE_CANCELLED,
VerificationRequest,
VerificationRequestEvent,
} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
@ -34,7 +35,7 @@ import SyntaxHighlight from '../elements/SyntaxHighlight';
import { _t } from '../../../languageHandler';
import Field from "../elements/Field";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { useEventEmitter } from "../../../hooks/useEventEmitter";
import { useTypedEventEmitter } from "../../../hooks/useEventEmitter";
import WidgetStore, { IApp } from "../../../stores/WidgetStore";
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
import { SETTINGS } from "../../../settings/Settings";
@ -756,7 +757,7 @@ const VerificationRequestExplorer: React.FC<{
const [timeout, setRequestTimeout] = useState(request.timeout);
/* Re-render if something changes state */
useEventEmitter(request, "change", updateState);
useTypedEventEmitter(request, VerificationRequestEvent.Change, updateState);
/* Keep re-rendering if there's a timeout */
useEffect(() => {