Upgrade to React Router v6 (#2919)

This commit is contained in:
Quentin Gliech
2025-01-06 18:00:20 +01:00
committed by GitHub
parent 46a82b2c39
commit b5f4a07868
19 changed files with 112 additions and 254 deletions

View File

@@ -15,7 +15,7 @@ import {
useRef,
useMemo,
} from "react";
import { useHistory } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { logger } from "matrix-js-sdk/src/logger";
import { useTranslation } from "react-i18next";
import { type ISyncStateData, type SyncState } from "matrix-js-sdk/src/sync";
@@ -144,7 +144,7 @@ interface Props {
}
export const ClientProvider: FC<Props> = ({ children }) => {
const history = useHistory();
const navigate = useNavigate();
// null = signed out, undefined = loading
const [initClientState, setInitClientState] = useState<
@@ -228,9 +228,9 @@ export const ClientProvider: FC<Props> = ({ children }) => {
await client.clearStores();
clearSession();
setInitClientState(null);
history.push("/");
navigate("/");
PosthogAnalytics.instance.setRegistrationType(RegistrationType.Guest);
}, [history, initClientState?.client]);
}, [navigate, initClientState?.client]);
const { t } = useTranslation();