From 61de5f2feda24bdc6f6dc75055f3be69a8f81ef6 Mon Sep 17 00:00:00 2001 From: Sayaka Ono Date: Thu, 5 Dec 2024 11:00:34 -0800 Subject: [PATCH] Invalidate animal tags when movement task is completed --- packages/webapp/src/containers/Task/saga.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/webapp/src/containers/Task/saga.js b/packages/webapp/src/containers/Task/saga.js index c1d7166867..21b677b7c5 100644 --- a/packages/webapp/src/containers/Task/saga.js +++ b/packages/webapp/src/containers/Task/saga.js @@ -85,6 +85,7 @@ import { import { setFormData } from '../hooks/useHookFormPersist/hookFormPersistSlice'; import { formatSoilAmendmentProductToDBStructure, getSubtaskName } from '../../util/task'; import { getEndpoint, getMovementTaskBody } from './sagaUtils'; +import { api } from '../../store/api/apiSlice'; const taskTypeEndpoint = [ 'cleaning_task', @@ -790,6 +791,10 @@ export function* completeTaskSaga({ payload: { task_id, data, returnPath } }) { message: i18n.t('message:TASK.COMPLETE.SUCCESS'), pathname: returnPath ?? '/tasks', }); + + if (task_translation_key === 'MOVEMENT_TASK') { + yield put(api.util.invalidateTags(['Animals', 'AnimalBatches'])); + } } } catch (e) { console.log(e);