fix mutations

This commit is contained in:
Chris Kruining 2025-01-07 12:10:06 +01:00
parent 88a4ddd866
commit 59f39ee141
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2

View file

@ -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)!;