Move state update listeners from constructor to componentDidMount (#28341)
* Move state update listeners from constructor to componentDidMount Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2d9982f9f0
commit
0899165d9e
@@ -58,7 +58,9 @@ export default class DateSeparator extends React.Component<IProps, IState> {
|
||||
this.state = {
|
||||
jumpToDateEnabled: SettingsStore.getValue("feature_jump_to_date"),
|
||||
};
|
||||
}
|
||||
|
||||
public componentDidMount(): void {
|
||||
// We're using a watcher so the date headers in the timeline are updated
|
||||
// when the lab setting is toggled.
|
||||
this.settingWatcherRef = SettingsStore.watchSetting(
|
||||
|
||||
@@ -59,7 +59,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private unmounted = true;
|
||||
private unmounted = false;
|
||||
private image = createRef<HTMLImageElement>();
|
||||
private placeholder = createRef<HTMLDivElement>();
|
||||
private timeout?: number;
|
||||
|
||||
@@ -21,10 +21,6 @@ interface IProps {
|
||||
}
|
||||
|
||||
export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public render(): React.ReactNode {
|
||||
const url = this.props.mxEvent.getContent()["url"];
|
||||
const prevUrl = this.props.mxEvent.getPrevContent()["url"];
|
||||
|
||||
@@ -75,6 +75,10 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
||||
this.context.on(ClientEvent.Sync, this.reconnectedListener);
|
||||
};
|
||||
|
||||
public componentDidMount(): void {
|
||||
this.unmounted = false;
|
||||
}
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
this.unmounted = true;
|
||||
this.context.off(ClientEvent.Sync, this.reconnectedListener);
|
||||
|
||||
Reference in New Issue
Block a user