From 59f39ee141abd4f868e4e75b58b53c14d0011577 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Tue, 7 Jan 2025 12:10:06 +0100 Subject: [PATCH] fix mutations --- src/routes/(editor)/edit.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/(editor)/edit.tsx b/src/routes/(editor)/edit.tsx index 1bf8136..06a1984 100644 --- a/src/routes/(editor)/edit.tsx +++ b/src/routes/(editor)/edit.tsx @@ -114,12 +114,13 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => { switch (m.kind) { case MutarionKind.Update: { const entry = entries.get(index as any)!; - return { kind: MutarionKind.Update, key: entry.key, lang, file: files.get(lang)! }; + return { kind: MutarionKind.Update, key: entry.key, lang, file: files.get(lang)!, value: m.value }; } case MutarionKind.Create: { if (typeof m.value === 'object') { - return Object.entries(m.value).map(([lang, value]) => ({ kind: MutarionKind.Create, key: m.key, lang, file: files.get(lang)!, value })); + const { key, ...locales } = m.value; + return Object.entries(locales).map(([lang, value]) => ({ kind: MutarionKind.Create, key, lang, file: files.get(lang)!, value })); } const entry = entries.get(index as any)!;