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

This commit is contained in:
jasquat 2023-01-26 10:50:46 -05:00
parent 356cca8416
commit 21d1d11445
2 changed files with 7 additions and 7 deletions

View File

@ -25,8 +25,12 @@ export default function APIErrorProvider({ children }) {
const contextValue = React.useMemo( const contextValue = React.useMemo(
() => ({ () => ({
error, error,
addError: (newError: ErrorForDisplay | null) => addError(newError), addError: (newError: ErrorForDisplay | null) => {
removeError: () => removeError(), addError(newError);
},
removeError: () => {
removeError();
},
}), }),
[error] [error]
); );

View File

@ -23,15 +23,11 @@ import Configuration from './Configuration';
import JsonSchemaFormBuilder from './JsonSchemaFormBuilder'; import JsonSchemaFormBuilder from './JsonSchemaFormBuilder';
import ProcessModelNewExperimental from './ProcessModelNewExperimental'; import ProcessModelNewExperimental from './ProcessModelNewExperimental';
import ProcessInstanceFindById from './ProcessInstanceFindById'; import ProcessInstanceFindById from './ProcessInstanceFindById';
import useAPIError from '../hooks/UseApiError';
export default function AdminRoutes() { export default function AdminRoutes() {
const location = useLocation(); const location = useLocation();
const { removeError } = useAPIError();
useEffect(() => { useEffect(() => {}, [location]);
removeError();
}, [location, removeError]);
if (UserService.hasRole(['admin'])) { if (UserService.hasRole(['admin'])) {
return ( return (