Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 606eaa5

Browse files
authored
StickerPicker: update when accountdata is updated (#10945)
* StickerPicker: update when accountdata is updated This was incorrectly listening for in-room account data; in fact `m.widgets` is global account data. Fixes some flaky cypress tests. * another ref
1 parent 8513d2f commit 606eaa5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/views/rooms/Stickerpicker.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ limitations under the License.
1515
*/
1616

1717
import React from "react";
18-
import { Room, RoomEvent } from "matrix-js-sdk/src/models/room";
18+
import { Room } from "matrix-js-sdk/src/models/room";
1919
import { logger } from "matrix-js-sdk/src/logger";
2020
import { IWidget } from "matrix-widget-api";
21+
import { ClientEvent } from "matrix-js-sdk/src/client";
2122

2223
import { _t, _td } from "../../../languageHandler";
2324
import AppTile from "../elements/AppTile";
@@ -138,7 +139,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
138139
this.dispatcherRef = dis.register(this.onAction);
139140

140141
// Track updates to widget state in account data
141-
MatrixClientPeg.get().on(RoomEvent.AccountData, this.updateWidget);
142+
MatrixClientPeg.get().on(ClientEvent.AccountData, this.updateWidget);
142143

143144
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
144145
// Initialise widget state from current account data
@@ -147,7 +148,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
147148

148149
public componentWillUnmount(): void {
149150
const client = MatrixClientPeg.get();
150-
if (client) client.removeListener(RoomEvent.AccountData, this.updateWidget);
151+
if (client) client.removeListener(ClientEvent.AccountData, this.updateWidget);
151152
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
152153
window.removeEventListener("resize", this.onResize);
153154
if (this.dispatcherRef) {

0 commit comments

Comments
 (0)