From e9f17e25fc906eb7c4fad2328734e131b30b2dce Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Wed, 13 Sep 2023 14:43:17 +0300 Subject: [PATCH 1/2] fix: fix broken return to url when login back in --- .../Authentication/Kratos/KratosAuthSessionChecker.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx b/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx index d472f7699..63321afee 100644 --- a/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx +++ b/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx @@ -14,7 +14,7 @@ export default function KratosAuthSessionChecker({ }: KratosAuthSessionCheckerProps) { const [session, setSession] = useState(); - const { push, pathname } = useRouter(); + const { push } = useRouter(); useEffect(() => { if (!isAuthEnabled()) { @@ -27,7 +27,11 @@ export default function KratosAuthSessionChecker({ setSession(data); }) .catch((err: AxiosError) => { - const url = `${pathname}`; + // Due to the conflict between NextJS Routing and React Router, we can + // get the current URL from next router accurately, but we can rely on + // the window location to get the current URL accurately. This can be + // fixed in the future when we move to NextJS fully. + const url = window.location.pathname; switch (err.response?.status) { case 403: // This is a legacy error code thrown. See code 422 for @@ -48,7 +52,7 @@ export default function KratosAuthSessionChecker({ // Something else happened! return Promise.reject(err); }); - }, [pathname, push]); + }, [push]); if (isAuthEnabled() && !session) { return null; From 74b0ae073f1cf3b62df157716c698d5cd8b9a3ad Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Wed, 13 Sep 2023 14:44:08 +0300 Subject: [PATCH 2/2] fix: fix link to source config for health item broken Closes #967 --- src/components/SchemaResourcePage/SchemaResourceEdit.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/SchemaResourcePage/SchemaResourceEdit.tsx b/src/components/SchemaResourcePage/SchemaResourceEdit.tsx index 1059bbfd4..4d8d3db04 100644 --- a/src/components/SchemaResourcePage/SchemaResourceEdit.tsx +++ b/src/components/SchemaResourcePage/SchemaResourceEdit.tsx @@ -22,6 +22,7 @@ import { Head } from "../Head/Head"; import HealthSpecEditor from "../SpecEditor/HealthSpecEditor"; import { Button } from "../Button"; import DeleteResource from "./Delete/DeleteResource"; +import { HealthCheckEdit } from "../Canary/HealthCheckEdit"; const CodeEditor = dynamic( () => import("../CodeEditor").then((m) => m.CodeEditor), @@ -282,7 +283,13 @@ export function SchemaResourceEdit({ )} {name} - {!!source && ( + {!!source && table === "canaries" && id ? ( + + ) : (
Catalog source