From e3bc9890a3d831e5fc403dbdcd831e2efeab0258 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Wed, 23 Oct 2024 11:50:05 +0200 Subject: [PATCH] reset error in error dialog (#34203) (#34211) fixes: #33968 Signed-off-by: Erik Jan de Wit (cherry picked from commit 34f090143ca5edf6d0e142fa6b5d902e0756e0f8) --- .../admin-ui/src/components/error/ErrorRenderer.tsx | 11 ++++++++--- js/libs/ui-shared/src/utils/useFetch.ts | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/apps/admin-ui/src/components/error/ErrorRenderer.tsx b/js/apps/admin-ui/src/components/error/ErrorRenderer.tsx index 0cfe9554719..cf80e1972e5 100644 --- a/js/apps/admin-ui/src/components/error/ErrorRenderer.tsx +++ b/js/apps/admin-ui/src/components/error/ErrorRenderer.tsx @@ -1,3 +1,7 @@ +import { + useErrorBoundary, + type FallbackProps, +} from "@keycloak/keycloak-ui-shared"; import { Alert, AlertActionCloseButton, @@ -7,10 +11,9 @@ import { } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import { type FallbackProps } from "@keycloak/keycloak-ui-shared"; - export const ErrorRenderer = ({ error }: FallbackProps) => { const { t } = useTranslation(); + const { showBoundary } = useErrorBoundary(); const reset = () => { window.location.href = window.location.origin + window.location.pathname; @@ -26,7 +29,9 @@ export const ErrorRenderer = ({ error }: FallbackProps) => { } actionLinks={ - {t("retry")} + showBoundary()}> + {t("retry")} + } > diff --git a/js/libs/ui-shared/src/utils/useFetch.ts b/js/libs/ui-shared/src/utils/useFetch.ts index 09419d44f14..89f4eaecf08 100644 --- a/js/libs/ui-shared/src/utils/useFetch.ts +++ b/js/libs/ui-shared/src/utils/useFetch.ts @@ -26,7 +26,6 @@ export function useFetch( useEffect(() => { const controller = new AbortController(); const { signal } = controller; - showBoundary(); adminClientCall() .then((result) => { if (!signal.aborted) {