Remove unused packages and fix invariant violation on AsyncStore onNotReady (#9404)

* Remove traces of browser-request & mocha

* Remove unused matrix-react-test-utils

* Fix dispatcher invariant violation

* Add null-guard

* Improve types

* Fix null-guard

* Fix issue with authed users going directly to /#/login
This commit is contained in:
Michael Telatynski 2022-10-13 09:22:32 +01:00 committed by GitHub
parent 28bd58e551
commit 1800cb8c71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 57 deletions

View file

@ -38,7 +38,7 @@ interface IProps {
interface IState {
searchQuery: string;
langs: string[];
langs: Awaited<ReturnType<typeof languageHandler.getAllLanguagesFromJson>>;
}
export default class LanguageDropdown extends React.Component<IProps, IState> {
@ -60,7 +60,7 @@ export default class LanguageDropdown extends React.Component<IProps, IState> {
});
this.setState({ langs });
}).catch(() => {
this.setState({ langs: ['en'] });
this.setState({ langs: [{ value: 'en', label: "English" }] });
});
if (!this.props.value) {
@ -83,7 +83,7 @@ export default class LanguageDropdown extends React.Component<IProps, IState> {
return <Spinner />;
}
let displayedLanguages;
let displayedLanguages: Awaited<ReturnType<typeof languageHandler.getAllLanguagesFromJson>>;
if (this.state.searchQuery) {
displayedLanguages = this.state.langs.filter((lang) => {
return languageMatchesSearchQuery(this.state.searchQuery, lang);

View file

@ -154,9 +154,10 @@ export default class PipView extends React.Component<IProps, IState> {
public componentWillUnmount() {
LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallChangeRoom, this.updateCalls);
LegacyCallHandler.instance.removeListener(LegacyCallHandlerEvent.CallState, this.updateCalls);
MatrixClientPeg.get().removeListener(CallEvent.RemoteHoldUnhold, this.onCallRemoteHold);
const cli = MatrixClientPeg.get();
cli?.removeListener(CallEvent.RemoteHoldUnhold, this.onCallRemoteHold);
RoomViewStore.instance.removeListener(UPDATE_EVENT, this.onRoomViewStoreUpdate);
const room = MatrixClientPeg.get().getRoom(this.state.viewedRoomId);
const room = cli?.getRoom(this.state.viewedRoomId);
if (room) {
WidgetLayoutStore.instance.off(WidgetLayoutStore.emissionForRoom(room), this.updateCalls);
}