including improved command handling and sync status updates

This commit is contained in:
Mo Tarbin
2026-05-25 01:56:14 -04:00
parent d618a09f6d
commit b69fa34b9f
10 changed files with 183 additions and 23 deletions

View File

@@ -634,15 +634,16 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
createChoreMutation
.mutateAsync(chore)
.then(result => {
const choreData = result?.res
const choreData = result
if (choreData?._pendingCreate) {
// Offline: task queued, add temp chore to UI immediately
onChoreUpdate(choreData)
} else {
// Online: choreData is the server's parsed response ({ res: id })
// Online: choreData is the created chore object returned by the mutation
onChoreUpdate({
...chore,
id: choreData?.res || choreData?.id,
...choreData,
id: choreData?.id,
nextDueDate: chore.dueDate,
})
}