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

fixes: #32847

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-04 14:52:47 +02:00 committed by GitHub
parent 05e8b932c3
commit 57dc5a1481
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -10,7 +10,7 @@ import { useRequiredContext } from "./useRequiredContext";
export interface ErrorBoundaryContextValue {
error?: Error;
showBoundary: (error: Error) => void;
showBoundary: (error?: Error) => void;
}
const ErrorBoundaryContext = createNamedContext<
@ -40,7 +40,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) {