Fix React class constructor signature to not pass context
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
983db465c3
commit
62c765bfd3
41 changed files with 89 additions and 90 deletions
|
@ -40,8 +40,8 @@ export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
|
|||
private unmounted = false;
|
||||
private dispatcherRef?: string;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
page: "",
|
||||
|
|
|
@ -252,8 +252,8 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||
// A map to allow groupers to maintain consistent keys even if their first event is uprooted due to back-pagination.
|
||||
public grouperKeyMap = new WeakMap<MatrixEvent, string>();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
// previous positions the read marker has been in, so we can
|
||||
|
|
|
@ -38,8 +38,8 @@ export default class NotificationPanel extends React.PureComponent<IProps, IStat
|
|||
|
||||
private card = React.createRef<HTMLDivElement>();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
narrow: false,
|
||||
|
|
|
@ -65,8 +65,8 @@ export default class RightPanel extends React.Component<Props, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: Props, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
searchQuery: "",
|
||||
|
|
|
@ -91,8 +91,8 @@ export default class RoomStatusBar extends React.PureComponent<IProps, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
syncState: this.context.getSyncState(),
|
||||
|
|
|
@ -374,16 +374,16 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
public static contextType = SDKContext;
|
||||
declare public context: React.ContextType<typeof SDKContext>;
|
||||
|
||||
public constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IRoomProps) {
|
||||
super(props);
|
||||
|
||||
this.askToJoinEnabled = SettingsStore.getValue("feature_ask_to_join");
|
||||
|
||||
if (!context.client) {
|
||||
if (!this.context.client) {
|
||||
throw new Error("Unable to create RoomView without MatrixClient");
|
||||
}
|
||||
|
||||
const llMembers = context.client.hasLazyLoadMembersEnabled();
|
||||
const llMembers = this.context.client.hasLazyLoadMembersEnabled();
|
||||
this.state = {
|
||||
roomId: undefined,
|
||||
roomLoading: true,
|
||||
|
@ -417,7 +417,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
showJoinLeaves: true,
|
||||
showAvatarChanges: true,
|
||||
showDisplaynameChanges: true,
|
||||
matrixClientIsReady: context.client?.isInitialSyncComplete(),
|
||||
matrixClientIsReady: this.context.client?.isInitialSyncComplete(),
|
||||
mainSplitContentType: MainSplitContentType.Timeline,
|
||||
timelineRenderingType: TimelineRenderingType.Room,
|
||||
liveTimeline: undefined,
|
||||
|
|
|
@ -601,13 +601,13 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
|||
|
||||
private dispatcherRef?: string;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
let phase = Phase.Landing;
|
||||
|
||||
const creator = this.props.space.currentState.getStateEvents(EventType.RoomCreate, "")?.getSender();
|
||||
const showSetup = this.props.justCreatedOpts && context.getSafeUserId() === creator;
|
||||
const showSetup = this.props.justCreatedOpts && this.context.getSafeUserId() === creator;
|
||||
|
||||
if (showSetup) {
|
||||
phase =
|
||||
|
|
|
@ -86,8 +86,8 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
|||
// Set by setEventId in ctor.
|
||||
private eventId!: string;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.setEventId(this.props.mxEvent);
|
||||
const thread = this.props.room.getThread(this.eventId) ?? undefined;
|
||||
|
|
|
@ -259,8 +259,8 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
|||
private callEventGroupers = new Map<string, LegacyCallEventGrouper>();
|
||||
private initialReadMarkerId: string | null = null;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
debuglog("mounting");
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
private readonly dndWatcherRef?: string;
|
||||
private buttonRef: React.RefObject<HTMLButtonElement | null> = createRef();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
contextMenuPosition: null,
|
||||
|
|
|
@ -34,8 +34,8 @@ export default class UserView extends React.Component<IProps, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: true,
|
||||
};
|
||||
|
|
|
@ -66,8 +66,8 @@ export default class SoftLogout extends React.Component<IProps, IState> {
|
|||
public static contextType = SDKContext;
|
||||
declare public context: React.ContextType<typeof SDKContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
loginView: LoginView.Loading,
|
||||
|
|
|
@ -130,8 +130,8 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
|
|||
|
||||
private reactButtonRef = createRef<any>(); // XXX Ref to a functional component
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
canRedact: false,
|
||||
|
|
|
@ -145,8 +145,8 @@ export default class AppTile extends React.Component<IProps, IState> {
|
|||
private dispatcherRef?: string;
|
||||
private unmounted = false;
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
// The key used for PersistedElement
|
||||
this.persistKey = getPersistKey(WidgetUtils.getWidgetUid(this.props.app));
|
||||
|
|
|
@ -28,9 +28,9 @@ export default class PersistentApp extends React.Component<IProps> {
|
|||
declare public context: ContextType<typeof MatrixClientContext>;
|
||||
private room: Room;
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
this.room = context.getRoom(this.props.persistentRoomId)!;
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
this.room = this.context.getRoom(this.props.persistentRoomId)!;
|
||||
}
|
||||
|
||||
public render(): JSX.Element | null {
|
||||
|
|
|
@ -71,8 +71,8 @@ export default class ReplyChain extends React.Component<IProps, IState> {
|
|||
private room: Room;
|
||||
private blockquoteRef = React.createRef<HTMLQuoteElement>();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
events: [],
|
||||
|
|
|
@ -37,8 +37,8 @@ export default class RoomAliasField extends React.PureComponent<IProps, IState>
|
|||
|
||||
private fieldRef = createRef<Field>();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
isValid: true,
|
||||
|
|
|
@ -31,8 +31,8 @@ class ReactionPicker extends React.Component<IProps, IState> {
|
|||
public static contextType = RoomContext;
|
||||
declare public context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
selectedEmojis: new Set(Object.keys(this.getReactions())),
|
||||
|
|
|
@ -47,8 +47,8 @@ class LocationPicker extends React.Component<ILocationPickerProps, IState> {
|
|||
private geolocate?: maplibregl.GeolocateControl;
|
||||
private marker?: maplibregl.Marker;
|
||||
|
||||
public constructor(props: ILocationPickerProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: ILocationPickerProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
position: undefined,
|
||||
|
|
|
@ -51,8 +51,8 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
|
|||
private pills = new ReactRootManager();
|
||||
private tooltips = new ReactRootManager();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const cli = this.context;
|
||||
const userId = cli.getSafeUserId();
|
||||
|
|
|
@ -36,8 +36,8 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
|||
private mapId: string;
|
||||
private reconnectedListener: ClientEventHandlerMap[ClientEvent.Sync];
|
||||
|
||||
public constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
// multiple instances of same map might be in document
|
||||
// eg thread and main timeline, reply
|
||||
|
|
|
@ -142,8 +142,8 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
|
|||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
private seenEventIds: string[] = []; // Events we have already seen
|
||||
|
||||
public constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
selected: null,
|
||||
|
|
|
@ -77,8 +77,8 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||
public static contextType = RoomContext;
|
||||
declare public context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
myReactions: this.getMyReactions(),
|
||||
|
|
|
@ -77,8 +77,8 @@ export default class TimelineCard extends React.Component<IProps, IState> {
|
|||
private card = React.createRef<HTMLDivElement>();
|
||||
private readReceiptsSettingWatcher: string | undefined;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showReadReceipts: SettingsStore.getValue("showReadReceipts", props.room.roomId),
|
||||
layout: SettingsStore.getValue("layout"),
|
||||
|
|
|
@ -101,8 +101,8 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
canSetCanonicalAlias: false,
|
||||
};
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const state: IState = {
|
||||
altAliases: [],
|
||||
|
|
|
@ -51,8 +51,8 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||
public static contextType = RoomContext;
|
||||
declare public context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
// list of completionResults, each containing completions
|
||||
|
|
|
@ -99,8 +99,8 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
private readonly replyToEvent?: MatrixEvent;
|
||||
private model!: EditorModel;
|
||||
|
||||
public constructor(props: IEditMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IEditMessageComposerProps) {
|
||||
super(props);
|
||||
|
||||
const isRestored = this.createEditorModel();
|
||||
const ev = this.props.editState.getEvent();
|
||||
|
|
|
@ -300,8 +300,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
|
||||
private unmounted = false;
|
||||
|
||||
public constructor(props: EventTileProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: EventTileProps) {
|
||||
super(props);
|
||||
|
||||
const thread = this.thread;
|
||||
|
||||
|
|
|
@ -78,10 +78,10 @@ export default class MemberList extends React.Component<IProps, IState> {
|
|||
declare public context: React.ContextType<typeof SDKContext>;
|
||||
private tiles: Map<string, MemberTile> = new Map();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
this.state = this.getMembersState([], []);
|
||||
this.showPresence = context?.memberListStore.isPresenceEnabled() ?? true;
|
||||
this.showPresence = this.context?.memberListStore.isPresenceEnabled() ?? true;
|
||||
}
|
||||
|
||||
private listenForMembersChanges(): void {
|
||||
|
|
|
@ -124,9 +124,8 @@ export class MessageComposer extends React.Component<IProps, IState> {
|
|||
isRichTextEnabled: true,
|
||||
};
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context; // otherwise React will only set it prior to render due to type def above
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const isWysiwygLabEnabled = SettingsStore.getValue<boolean>("feature_wysiwyg_composer");
|
||||
let isRichTextEnabled = true;
|
||||
|
|
|
@ -426,8 +426,8 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
sublists: {},
|
||||
|
|
|
@ -27,8 +27,8 @@ export default class RoomUpgradeWarningBar extends React.PureComponent<IProps, I
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const tombstone = this.props.room.currentState.getStateEvents("m.room.tombstone", "");
|
||||
this.state = {
|
||||
|
|
|
@ -41,8 +41,8 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||
// A map of <callId, LegacyCallEventGrouper>
|
||||
private callEventGroupers = new Map<string, LegacyCallEventGrouper>();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.buildLegacyCallEventGroupers(this.props.timeline);
|
||||
}
|
||||
|
|
|
@ -249,8 +249,8 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
|||
private dispatcherRef?: string;
|
||||
private sendHistoryManager: SendHistoryManager;
|
||||
|
||||
public constructor(props: ISendMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: ISendMessageComposerProps) {
|
||||
super(props);
|
||||
|
||||
if (this.props.mxClient.getCrypto() && this.props.mxClient.isRoomEncrypted(this.props.room.roomId)) {
|
||||
this.prepareToEncrypt = throttle(
|
||||
|
|
|
@ -56,8 +56,8 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
|
|||
declare public context: React.ContextType<typeof RoomContext>;
|
||||
private voiceRecordingId: string;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {};
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ export default class CryptographyPanel extends React.Component<IProps, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
if (!context.getCrypto()) {
|
||||
if (!this.context.getCrypto()) {
|
||||
this.state = { deviceIdentityKey: null };
|
||||
} else {
|
||||
this.state = { deviceIdentityKey: undefined };
|
||||
|
|
|
@ -35,8 +35,8 @@ export default class GeneralRoomSettingsTab extends React.Component<IProps, ISta
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
isRoomPublished: false, // loaded async
|
||||
|
|
|
@ -44,10 +44,10 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.roomProps = EchoChamber.forRoom(context.getRoom(this.props.roomId)!);
|
||||
this.roomProps = EchoChamber.forRoom(this.context.getRoom(this.props.roomId)!);
|
||||
|
||||
let currentSound = "default";
|
||||
const soundData = Notifier.getSoundForRoom(this.props.roomId);
|
||||
|
|
|
@ -62,8 +62,8 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const state = this.props.room.currentState;
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
appVersion: null,
|
||||
|
|
|
@ -53,8 +53,8 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
|
|||
public static contextType = MatrixClientContext;
|
||||
declare public context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: {}, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
public constructor(props: {}) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
mediaDevices: null,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue