Update type and usage of window.matrixChat to be better React 18 friendly (#28415)
* Update type and usage of window.matrixChat to be better React 18 friendly Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make modules import async to make the file testable Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
349c9b0c26
commit
ca239fee4d
8 changed files with 351 additions and 13 deletions
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type MatrixChat from "../components/structures/MatrixChat";
|
||||
import Views from "../Views";
|
||||
|
||||
export function isLoggedIn(): boolean {
|
||||
|
@ -14,6 +13,5 @@ export function isLoggedIn(): boolean {
|
|||
// `element-web` and into this file? Better yet, we should probably create a
|
||||
// store to hold this state.
|
||||
// See also https://github.com/vector-im/element-web/issues/15034.
|
||||
const app = window.matrixChat;
|
||||
return (app as MatrixChat)?.state.view === Views.LOGGED_IN;
|
||||
return window.matrixChat?.state.view === Views.LOGGED_IN;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue