Migrate away from Legacy React Contexts
This commit is contained in:
parent
2e8d66fa36
commit
937b32663c
55 changed files with 651 additions and 750 deletions
|
@ -26,8 +26,8 @@ import sanitizeHtml from 'sanitize-html';
|
|||
import sdk from '../../index';
|
||||
import dis from '../../dispatcher';
|
||||
import MatrixClientPeg from '../../MatrixClientPeg';
|
||||
import { MatrixClient } from 'matrix-js-sdk';
|
||||
import classnames from 'classnames';
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
|
||||
export default class EmbeddedPage extends React.PureComponent {
|
||||
static propTypes = {
|
||||
|
@ -39,9 +39,7 @@ export default class EmbeddedPage extends React.PureComponent {
|
|||
scrollbar: PropTypes.bool,
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
matrixClient: PropTypes.instanceOf(MatrixClient),
|
||||
};
|
||||
static contextType = MatrixClientContext;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -104,7 +102,7 @@ export default class EmbeddedPage extends React.PureComponent {
|
|||
|
||||
render() {
|
||||
// HACK: Workaround for the context's MatrixClient not updating.
|
||||
const client = this.context.matrixClient || MatrixClientPeg.get();
|
||||
const client = this.context || MatrixClientPeg.get();
|
||||
const isGuest = client ? client.isGuest() : true;
|
||||
const className = this.props.className;
|
||||
const classes = classnames({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue