reset error so when doing a new request, error could be gone (#32974) (#33590)

fixes: #32847

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
(cherry picked from commit 57dc5a1481)
This commit is contained in:
Erik Jan de Wit
2024-10-08 14:34:27 +02:00
committed by GitHub
parent 67b16a099d
commit c559a3e51b
2 changed files with 3 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ import {
export interface ErrorBoundaryContextValue {
error?: Error;
showBoundary: (error: Error) => void;
showBoundary: (error?: Error) => void;
}
const ErrorBoundaryContext = createNamedContext<
@@ -42,7 +42,7 @@ export class ErrorBoundaryProvider extends Component<
return { error };
};
showBoundary = (error: Error) => {
showBoundary = (error?: Error) => {
this.setState({ error });
};

View File

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