mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
fix(todo): persist labelIds on task creation and merge metadata on label update
- createTask: store labelIds in metadata when provided (was silently ignored) - updateLabels: read existing metadata first and merge, instead of overwriting the entire metadata object (was destroying assignee, storypoints, etc.) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8409f8a8a2
commit
e94775de25
1 changed files with 4 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ export const tasksStore = {
|
|||
order: count,
|
||||
recurrenceRule: data.recurrenceRule ?? null,
|
||||
subtasks: data.subtasks,
|
||||
...(data.labelIds?.length && { metadata: { labelIds: data.labelIds } }),
|
||||
};
|
||||
|
||||
const inserted = await taskCollection.insert(newLocal);
|
||||
|
|
@ -159,8 +160,10 @@ export const tasksStore = {
|
|||
return withErrorHandling(
|
||||
setError,
|
||||
async () => {
|
||||
const existing = await taskCollection.get(id);
|
||||
const existingMeta = (existing?.metadata as Record<string, unknown>) ?? {};
|
||||
const updated = await taskCollection.update(id, {
|
||||
metadata: { labelIds },
|
||||
metadata: { ...existingMeta, labelIds },
|
||||
} as Partial<LocalTask>);
|
||||
if (updated) {
|
||||
return toTask(updated);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue