Fix recurring tasks losing name and subtasks on status change (#886)

This commit is contained in:
Chris 2026-03-01 13:17:54 +02:00 committed by GitHub
parent 96db8c1362
commit edc9d214f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View file

@ -70,16 +70,14 @@ function buildUpdateAttributes(body, task, timezone) {
(task.recurrence_type === 'none' || !task.recurrence_type);
const attrs = {
name: body.name,
name: body.name !== undefined ? body.name : task.name,
priority:
body.priority !== undefined
? parsePriority(body.priority)
: undefined,
: task.priority,
status:
body.status !== undefined
? parseStatus(body.status)
: Task.STATUS.NOT_STARTED,
note: body.note,
body.status !== undefined ? parseStatus(body.status) : task.status,
note: body.note !== undefined ? body.note : task.note,
recurrence_type: recurrenceType,
recurrence_interval:
body.recurrence_interval !== undefined

View file

@ -92,13 +92,20 @@ export const updateTask = async (
taskUid: string,
taskData: Partial<Task>
): Promise<Task> => {
// Use original_name to prevent display name (e.g. "Monthly", "Daily")
// from overwriting the real task name in the database
const payload = { ...taskData };
if (payload.original_name && payload.name !== undefined) {
payload.name = payload.original_name;
}
const response = await fetch(
getApiPath(`task/${encodeURIComponent(taskUid)}`),
{
method: 'PATCH',
credentials: 'include',
headers: getPostHeaders(),
body: JSON.stringify(taskData),
body: JSON.stringify(payload),
}
);