Fix react context not being assigned during construction

This commit is contained in:
Michael Telatynski 2021-06-30 13:45:43 +01:00
parent 0a5abb09f4
commit 3a80df4222
2 changed files with 7 additions and 5 deletions

View file

@ -121,14 +121,15 @@ interface IState {
@replaceableComponent("views.rooms.EditMessageComposer")
export default class EditMessageComposer extends React.Component<IProps, IState> {
static contextType = MatrixClientContext;
context: React.ContextType<typeof MatrixClientContext>;
context!: React.ContextType<typeof MatrixClientContext>;
private readonly editorRef = createRef<BasicMessageComposer>();
private readonly dispatcherRef: string;
private model: EditorModel = null;
constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
super(props, context);
super(props);
this.context = context; // otherwise React will only set it prior to render due to type def above
this.state = {
saveDisabled: true,