Fix: update chore state handling on delete and archive actions

Response from backend just say sucessfull so we need to use the chore optimisitcally
This commit is contained in:
Mo Tarbin
2026-06-27 22:22:57 -04:00
parent 878031cae8
commit b2fdb049e2

View File

@@ -420,8 +420,8 @@ export const useChoreActions = ({
c => c.id !== chore.id,
)
setChores(newChores)
updateChoreInState(chore.id, 'deleted')
setFilteredChores(newFilteredChores)
queryClient.invalidateQueries(['chores'])
showSuccess({
title: 'Task Deleted',
message: 'The task has been deleted successfully.',
@@ -471,7 +471,7 @@ export const useChoreActions = ({
await new Promise((resolve, reject) => {
archiveChore.mutate(chore.id, {
onSuccess: data => {
updateChoreInState(data, 'archive')
updateChoreInState(chore, 'archive')
resolve(data)
},
onError: async error => {