reset error in error dialog (#34203)
fixes: #33968 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
af1a5ea2a8
commit
34f090143c
2 changed files with 8 additions and 4 deletions
|
@ -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>
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue