Skip to content

Commit

Permalink
Merge pull request #3571 from LiteFarmOrg/Invalidate_animal_tags_on_m…
Browse files Browse the repository at this point in the history
…ovement_task_completion

Invalidate animal tags when movement task is completed
  • Loading branch information
antsgar authored Dec 5, 2024
2 parents 74d9682 + 06fb3bd commit d60f304
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/webapp/src/containers/Task/saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import {
import { setFormData } from '../hooks/useHookFormPersist/hookFormPersistSlice';
import { formatSoilAmendmentProductToDBStructure, getSubtaskName } from '../../util/task';
import { formatAnimalIdsForReqBody, getEndpoint, getMovementTaskBody } from './sagaUtils';
import { api } from '../../store/api/apiSlice';

const taskTypeEndpoint = [
'cleaning_task',
Expand Down Expand Up @@ -797,6 +798,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);
Expand Down

0 comments on commit d60f304

Please sign in to comment.