From 108c39c1cfbae94dd9099a2ce87ca8880e4650cb Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 26 Jan 2023 10:50:46 -0500 Subject: [PATCH] do not reset error state from the adminroutes component since this causes the error to be removed right away and then cannot be displayed w/ burnettk --- spiffworkflow-frontend/src/contexts/APIErrorContext.tsx | 8 ++++++-- spiffworkflow-frontend/src/routes/AdminRoutes.tsx | 6 +----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spiffworkflow-frontend/src/contexts/APIErrorContext.tsx b/spiffworkflow-frontend/src/contexts/APIErrorContext.tsx index bfd7d0092..7e17750f6 100644 --- a/spiffworkflow-frontend/src/contexts/APIErrorContext.tsx +++ b/spiffworkflow-frontend/src/contexts/APIErrorContext.tsx @@ -25,8 +25,12 @@ export default function APIErrorProvider({ children }) { const contextValue = React.useMemo( () => ({ error, - addError: (newError: ErrorForDisplay | null) => addError(newError), - removeError: () => removeError(), + addError: (newError: ErrorForDisplay | null) => { + addError(newError); + }, + removeError: () => { + removeError(); + }, }), [error] ); diff --git a/spiffworkflow-frontend/src/routes/AdminRoutes.tsx b/spiffworkflow-frontend/src/routes/AdminRoutes.tsx index d87946f1c..43eba9218 100644 --- a/spiffworkflow-frontend/src/routes/AdminRoutes.tsx +++ b/spiffworkflow-frontend/src/routes/AdminRoutes.tsx @@ -23,15 +23,11 @@ import Configuration from './Configuration'; import JsonSchemaFormBuilder from './JsonSchemaFormBuilder'; import ProcessModelNewExperimental from './ProcessModelNewExperimental'; import ProcessInstanceFindById from './ProcessInstanceFindById'; -import useAPIError from '../hooks/UseApiError'; export default function AdminRoutes() { const location = useLocation(); - const { removeError } = useAPIError(); - useEffect(() => { - removeError(); - }, [location, removeError]); + useEffect(() => {}, [location]); if (UserService.hasRole(['admin'])) { return (