mirror of https://github.com/vector-im/riot-web
Fix runtime react errors for various parts of the app
These are just the ones that were causing console flooding on reload in development. * Elements in a list need a `key` * `super()` needs to be supplied with the same props as the parent * `<div>` (AccessibleButton) cannot be a descendant of `<p>` - this was a problem in the NewRoomIntro "Add topic" button * `label` is a non-boolean property and cannot receive "false"pull/21833/head
parent
98ba3fd6e6
commit
dad1d3f131
|
@ -25,17 +25,21 @@ import { EventSubscription } from 'fbemitter';
|
||||||
import AppTile from "./AppTile";
|
import AppTile from "./AppTile";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
// none
|
||||||
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
roomId: string;
|
roomId: string;
|
||||||
persistentWidgetId: string;
|
persistentWidgetId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.elements.PersistentApp")
|
@replaceableComponent("views.elements.PersistentApp")
|
||||||
export default class PersistentApp extends React.Component<{}, IState> {
|
export default class PersistentApp extends React.Component<IProps, IState> {
|
||||||
private roomStoreToken: EventSubscription;
|
private roomStoreToken: EventSubscription;
|
||||||
|
|
||||||
constructor() {
|
constructor(props: IProps) {
|
||||||
super({});
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
roomId: RoomViewStore.getRoomId(),
|
roomId: RoomViewStore.getRoomId(),
|
||||||
|
|
|
@ -116,7 +116,7 @@ const EmojiButton: React.FC<IEmojiButtonProps> = ({ addEmoji, menuPosition, narr
|
||||||
className={className}
|
className={className}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
title={!narrowMode && _t('Emoji picker')}
|
title={!narrowMode && _t('Emoji picker')}
|
||||||
label={narrowMode && _t("Add emoji")}
|
label={(narrowMode && _t("Add emoji")) || null}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{ contextMenu }
|
{ contextMenu }
|
||||||
|
@ -485,13 +485,14 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
||||||
className="mx_MessageComposer_button mx_MessageComposer_stickers"
|
className="mx_MessageComposer_button mx_MessageComposer_stickers"
|
||||||
onClick={() => this.showStickers(!this.state.showStickers)}
|
onClick={() => this.showStickers(!this.state.showStickers)}
|
||||||
title={title}
|
title={title}
|
||||||
label={this.state.narrowMode && _t("Send a sticker")}
|
label={(this.state.narrowMode && _t("Send a sticker")) || null}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!this.state.haveRecording && !this.state.narrowMode) {
|
if (!this.state.haveRecording && !this.state.narrowMode) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<AccessibleTooltipButton
|
<AccessibleTooltipButton
|
||||||
|
key="voice_message_send"
|
||||||
className="mx_MessageComposer_button mx_MessageComposer_voiceMessage"
|
className="mx_MessageComposer_button mx_MessageComposer_voiceMessage"
|
||||||
onClick={() => this.voiceRecordingButton.current?.onRecordStartEndClick()}
|
onClick={() => this.voiceRecordingButton.current?.onRecordStartEndClick()}
|
||||||
title={_t("Send voice message")}
|
title={_t("Send voice message")}
|
||||||
|
@ -615,7 +616,9 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
showStickers={this.state.showStickers}
|
showStickers={this.state.showStickers}
|
||||||
setShowStickers={this.showStickers}
|
setShowStickers={this.showStickers}
|
||||||
menuPosition={menuPosition} />,
|
menuPosition={menuPosition}
|
||||||
|
key="stickers"
|
||||||
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
const showSendButton = !this.state.isComposerEmpty || this.state.haveRecording;
|
const showSendButton = !this.state.isComposerEmpty || this.state.haveRecording;
|
||||||
|
|
|
@ -106,7 +106,11 @@ const NewRoomIntro = () => {
|
||||||
topicText = _t("Topic: %(topic)s ", { topic });
|
topicText = _t("Topic: %(topic)s ", { topic });
|
||||||
} else if (canAddTopic) {
|
} else if (canAddTopic) {
|
||||||
topicText = _t("<a>Add a topic</a> to help people know what it is about.", {}, {
|
topicText = _t("<a>Add a topic</a> to help people know what it is about.", {}, {
|
||||||
a: sub => <AccessibleButton kind="link" onClick={onTopicClick}>{ sub }</AccessibleButton>,
|
a: sub => <AccessibleButton
|
||||||
|
kind="link"
|
||||||
|
element="span"
|
||||||
|
onClick={onTopicClick}
|
||||||
|
>{ sub }</AccessibleButton>,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,12 +162,14 @@ export default class RoomHeader extends React.Component<IProps> {
|
||||||
className="mx_RoomHeader_button mx_RoomHeader_voiceCallButton"
|
className="mx_RoomHeader_button mx_RoomHeader_voiceCallButton"
|
||||||
onClick={() => this.props.onCallPlaced(PlaceCallType.Voice)}
|
onClick={() => this.props.onCallPlaced(PlaceCallType.Voice)}
|
||||||
title={_t("Voice call")}
|
title={_t("Voice call")}
|
||||||
|
key="voice"
|
||||||
/>;
|
/>;
|
||||||
const videoCallButton = <AccessibleTooltipButton
|
const videoCallButton = <AccessibleTooltipButton
|
||||||
className="mx_RoomHeader_button mx_RoomHeader_videoCallButton"
|
className="mx_RoomHeader_button mx_RoomHeader_videoCallButton"
|
||||||
onClick={(ev: React.MouseEvent<Element>) => ev.shiftKey ?
|
onClick={(ev: React.MouseEvent<Element>) => ev.shiftKey ?
|
||||||
this.displayInfoDialogAboutScreensharing() : this.props.onCallPlaced(PlaceCallType.Video)}
|
this.displayInfoDialogAboutScreensharing() : this.props.onCallPlaced(PlaceCallType.Video)}
|
||||||
title={_t("Video call")}
|
title={_t("Video call")}
|
||||||
|
key="video"
|
||||||
/>;
|
/>;
|
||||||
buttons.push(voiceCallButton, videoCallButton);
|
buttons.push(voiceCallButton, videoCallButton);
|
||||||
}
|
}
|
||||||
|
@ -177,6 +179,7 @@ export default class RoomHeader extends React.Component<IProps> {
|
||||||
className="mx_RoomHeader_button mx_RoomHeader_forgetButton"
|
className="mx_RoomHeader_button mx_RoomHeader_forgetButton"
|
||||||
onClick={this.props.onForgetClick}
|
onClick={this.props.onForgetClick}
|
||||||
title={_t("Forget room")}
|
title={_t("Forget room")}
|
||||||
|
key="forget"
|
||||||
/>;
|
/>;
|
||||||
buttons.push(forgetButton);
|
buttons.push(forgetButton);
|
||||||
}
|
}
|
||||||
|
@ -188,6 +191,7 @@ export default class RoomHeader extends React.Component<IProps> {
|
||||||
})}
|
})}
|
||||||
onClick={this.props.onAppsClick}
|
onClick={this.props.onAppsClick}
|
||||||
title={this.props.appsShown ? _t("Hide Widgets") : _t("Show Widgets")}
|
title={this.props.appsShown ? _t("Hide Widgets") : _t("Show Widgets")}
|
||||||
|
key="apps"
|
||||||
/>;
|
/>;
|
||||||
buttons.push(appsButton);
|
buttons.push(appsButton);
|
||||||
}
|
}
|
||||||
|
@ -197,6 +201,7 @@ export default class RoomHeader extends React.Component<IProps> {
|
||||||
className="mx_RoomHeader_button mx_RoomHeader_searchButton"
|
className="mx_RoomHeader_button mx_RoomHeader_searchButton"
|
||||||
onClick={this.props.onSearchClick}
|
onClick={this.props.onSearchClick}
|
||||||
title={_t("Search")}
|
title={_t("Search")}
|
||||||
|
key="search"
|
||||||
/>;
|
/>;
|
||||||
buttons.push(searchButton);
|
buttons.push(searchButton);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue