diff --git a/apps/desktop/src/app/settings/memory/field-control.tsx b/apps/desktop/src/app/settings/memory/field-control.tsx index 336fc8d1725b..62871be910ff 100644 --- a/apps/desktop/src/app/settings/memory/field-control.tsx +++ b/apps/desktop/src/app/settings/memory/field-control.tsx @@ -31,14 +31,24 @@ export function FieldTitle({ field }: { field: MemoryProviderField }) { export function FieldControl({ field, value, - onChange + onChange, + onCommit }: { field: MemoryProviderField value: string onChange: (value: string) => void + // Present on autosaving surfaces: discrete controls commit on change, text-like + // controls commit on blur. Absent (the modal), edits stay drafts until Save. + onCommit?: (value: string) => void }) { + const set = (next: string) => { + onChange(next) + onCommit?.(next) + } + const commitDraft = onCommit ? () => onCommit(value) : undefined + if (field.kind === 'bool') { - return onChange(checked ? 'true' : 'false')} /> + return set(checked ? 'true' : 'false')} /> } if (field.kind === 'number') { @@ -46,6 +56,7 @@ export function FieldControl({ onChange(event.target.value)} placeholder={field.placeholder} type="number" @@ -58,6 +69,7 @@ export function FieldControl({ return (