reset error in error dialog (#34203)

fixes: #33968

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-22 19:27:55 +02:00 committed by GitHub
parent af1a5ea2a8
commit 34f090143c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,7 @@
import {
useErrorBoundary,
type FallbackProps,
} from "@keycloak/keycloak-ui-shared";
import { import {
Alert, Alert,
AlertActionCloseButton, AlertActionCloseButton,
@ -7,10 +11,9 @@ import {
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { type FallbackProps } from "@keycloak/keycloak-ui-shared";
export const ErrorRenderer = ({ error }: FallbackProps) => { export const ErrorRenderer = ({ error }: FallbackProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { showBoundary } = useErrorBoundary();
const reset = () => { const reset = () => {
window.location.href = window.location.origin + window.location.pathname; window.location.href = window.location.origin + window.location.pathname;
@ -26,7 +29,9 @@ export const ErrorRenderer = ({ error }: FallbackProps) => {
<AlertActionCloseButton title={error.message} onClose={reset} /> <AlertActionCloseButton title={error.message} onClose={reset} />
} }
actionLinks={ actionLinks={
<AlertActionLink onClick={reset}>{t("retry")}</AlertActionLink> <AlertActionLink onClick={() => showBoundary()}>
{t("retry")}
</AlertActionLink>
} }
></Alert> ></Alert>
</PageSection> </PageSection>

View file

@ -26,7 +26,6 @@ export function useFetch<T>(
useEffect(() => { useEffect(() => {
const controller = new AbortController(); const controller = new AbortController();
const { signal } = controller; const { signal } = controller;
showBoundary();
adminClientCall() adminClientCall()
.then((result) => { .then((result) => {
if (!signal.aborted) { if (!signal.aborted) {