mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
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
This commit is contained in:
parent
8513d2f4ff
commit
606eaa5274
@ -15,9 +15,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { Room, RoomEvent } from "matrix-js-sdk/src/models/room";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { IWidget } from "matrix-widget-api";
|
||||
import { ClientEvent } from "matrix-js-sdk/src/client";
|
||||
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import AppTile from "../elements/AppTile";
|
||||
@ -138,7 +139,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
|
||||
// Track updates to widget state in account data
|
||||
MatrixClientPeg.get().on(RoomEvent.AccountData, this.updateWidget);
|
||||
MatrixClientPeg.get().on(ClientEvent.AccountData, this.updateWidget);
|
||||
|
||||
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
|
||||
// Initialise widget state from current account data
|
||||
@ -147,7 +148,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
const client = MatrixClientPeg.get();
|
||||
if (client) client.removeListener(RoomEvent.AccountData, this.updateWidget);
|
||||
if (client) client.removeListener(ClientEvent.AccountData, this.updateWidget);
|
||||
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
|
||||
window.removeEventListener("resize", this.onResize);
|
||||
if (this.dispatcherRef) {
|
||||
|
Loading…
Reference in New Issue
Block a user