@@ -73,6 +73,7 @@ const saveSession = (session: Session) =>
|
||||
const clearSession = () => localStorage.removeItem("matrix-auth-store");
|
||||
const isDisconnected = (syncState, syncData) =>
|
||||
syncState === "ERROR" && syncData?.error?.name === "ConnectionError";
|
||||
|
||||
interface ClientState {
|
||||
loading: boolean;
|
||||
isAuthenticated: boolean;
|
||||
@@ -123,8 +124,6 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
||||
|
||||
const onSync = (state: SyncState, _old: SyncState, data: ISyncStateData) => {
|
||||
setState((currentState) => {
|
||||
logger.log("syntData.name", data?.error?.name, "state:", state);
|
||||
console.log("Current state:", currentState);
|
||||
return {
|
||||
...currentState,
|
||||
disconnected: isDisconnected(state, data),
|
||||
|
||||
@@ -16,8 +16,7 @@ limitations under the License.
|
||||
|
||||
import classNames from "classnames";
|
||||
import React, { HTMLAttributes, ReactNode } from "react";
|
||||
import { logger } from "@sentry/utils";
|
||||
import { Trans } from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import styles from "./DisconnectedBanner.module.css";
|
||||
import { useClient } from "./ClientContext";
|
||||
@@ -32,18 +31,16 @@ export function DisconnectedBanner({
|
||||
className,
|
||||
...rest
|
||||
}: DisconnectedBannerProps) {
|
||||
const clientrp = useClient();
|
||||
logger.log(clientrp);
|
||||
const disconnected = clientrp.disconnected;
|
||||
const { t } = useTranslation();
|
||||
const { disconnected } = useClient();
|
||||
|
||||
return (
|
||||
<>
|
||||
{disconnected && (
|
||||
<Trans>
|
||||
<div className={classNames(styles.banner, className)} {...rest}>
|
||||
{children}
|
||||
Connectivity to the server has been lost.
|
||||
</div>
|
||||
</Trans>
|
||||
<div className={classNames(styles.banner, className)} {...rest}>
|
||||
{children}
|
||||
{t("Connectivity to the server has been lost.")}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user