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:
parent
05e8b932c3
commit
57dc5a1481
2 changed files with 3 additions and 2 deletions
|
@ -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 });
|
||||
};
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ export function useFetch<T>(
|
|||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
const { signal } = controller;
|
||||
showBoundary();
|
||||
adminClientCall()
|
||||
.then((result) => {
|
||||
if (!signal.aborted) {
|
||||
|
|
Loading…
Reference in a new issue