mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-27 09:45:12 +00:00
/task-show-on-error-fix (#1269)
* watch only the attributes from within params that we need from the TaskShow useEffect w/ burnettk * do not watch addError from the callback to avoid re-renders w/ burnettk --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
fed785b50c
commit
fa241e1a01
@ -52,6 +52,12 @@ export default function TaskShow() {
|
||||
|
||||
const { addError, removeError } = useAPIError();
|
||||
|
||||
const addErrorCallback = useCallback((error: ErrorForDisplay) => {
|
||||
addError(error);
|
||||
// FIXME: not sure what to do about addError. adding it to this array causes the page to endlessly reload
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// if a user can complete a task then the for-me page should
|
||||
// always work for them so use that since it will work in all cases
|
||||
const navigateToInterstitial = useCallback(
|
||||
@ -112,7 +118,7 @@ export default function TaskShow() {
|
||||
};
|
||||
const handleTaskFetchError = (error: ErrorForDisplay) => {
|
||||
setAtLeastOneTaskFetchHasError(true);
|
||||
addError(error);
|
||||
addErrorCallback(error);
|
||||
};
|
||||
|
||||
HttpService.makeCallToBackend({
|
||||
@ -125,9 +131,12 @@ export default function TaskShow() {
|
||||
successCallback: processTaskWithDataResult,
|
||||
failureCallback: handleTaskFetchError,
|
||||
});
|
||||
// FIXME: not sure what to do about addError. adding it to this array causes the page to endlessly reload
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [params, processBasicTaskResult]);
|
||||
}, [
|
||||
params.task_id,
|
||||
params.process_instance_id,
|
||||
processBasicTaskResult,
|
||||
addErrorCallback,
|
||||
]);
|
||||
|
||||
// Before we auto-saved form data, we remembered what data was in the form, and then created a synthetic submit event
|
||||
// in order to implement a "Save and close" button. That button no longer saves (since we have auto-save), but the crazy
|
||||
|
Loading…
x
Reference in New Issue
Block a user