Wrap all EventTiles with a TileErrorBoundary and guard parsePermalink (#7916)

Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
Michael Telatynski 2022-03-01 08:41:48 +00:00 committed by GitHub
parent 08c47ac473
commit 16e67e7716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 40 deletions

View file

@ -82,6 +82,7 @@ import RedactedBody from '../messages/RedactedBody';
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { shouldDisplayReply } from '../../../utils/Reply';
import PosthogTrackers from "../../../PosthogTrackers";
import TileErrorBoundary from '../messages/TileErrorBoundary';
export type GetRelationsForEvent = (eventId: string, relationType: string, eventType: string) => Relations;
@ -1114,7 +1115,7 @@ export default class EventTile extends React.Component<IProps, IState> {
return false;
}
render() {
private renderEvent() {
const msgtype = this.props.mxEvent.getContent().msgtype;
const eventType = this.props.mxEvent.getType() as EventType;
const {
@ -1641,6 +1642,12 @@ export default class EventTile extends React.Component<IProps, IState> {
}
}
}
public render() {
return <TileErrorBoundary mxEvent={this.props.mxEvent} layout={this.props.layout}>
{ this.renderEvent() }
</TileErrorBoundary>;
}
}
// XXX this'll eventually be dynamic based on the fields once we have extensible event types