fix(renderer): keep typed excluded apps and failed template edits instead of silently discarding them

- Settings > Input: the excluded-apps field was reset from every telemetry
  snapshot (several per second while typing), so edits vanished before blur
  saved them; it now syncs only when the saved list changes
- Templates: a failed save (e.g. deleted on another device) closed the dialog
  and dropped the edits; it now stays open and shows why, and a failed
  session start is reported too
This commit is contained in:
Yun Chan 2026-10-21 11:30:27 +09:00
parent 29d22504ae
commit 67cc920e06
4 changed files with 21 additions and 8 deletions

View file

@ -104,21 +104,24 @@ export function TemplateSection(): React.ReactElement {
isSavingRef.current = true
setSaving(true)
try {
if (editId) {
await window.electronAPI.dictationTemplate.update({
// 실패(다른 기기에서 지워짐 등)면 대화상자를 닫지 않는다 — 닫으면 편집한 필드가 조용히 사라진다.
const result = editId
? await window.electronAPI.dictationTemplate.update({
id: editId,
name: formName.trim(),
description: formDesc.trim(),
fields: formFields,
outputFormat: formOutput,
})
} else {
await window.electronAPI.dictationTemplate.create({
: await window.electronAPI.dictationTemplate.create({
name: formName.trim(),
description: formDesc.trim(),
fields: formFields,
outputFormat: formOutput,
})
if (!result.success) {
notify({ message: t('tools.templates.saveFailed', { reason: result.error.message }), severity: 'error' })
return
}
setDialogOpen(false)
loadData()
@ -139,7 +142,10 @@ export function TemplateSection(): React.ReactElement {
const handleStartSession = async (templateId: string) => {
setLastOutput(null)
await window.electronAPI.dictationTemplate.startSession({ templateId })
const result = await window.electronAPI.dictationTemplate.startSession({ templateId })
if (!result.success) {
notify({ message: t('tools.templates.startFailed', { reason: result.error.message }), severity: 'error' })
}
}
const handleCopyOutput = () => {

View file

@ -45,10 +45,13 @@ export function InputConsentPanel(): React.ReactElement {
const paused = telemetry?.paused ?? false
const suggestionEnabled = suggestion?.enabled ?? false
// 입력 상태는 스냅샷마다 새 객체로 온다 — 객체에 걸면 치는 도중 칸이 저장값으로 계속 되돌아간다.
// 저장된 목록 문자열이 실제로 바뀔 때만 맞춘다.
const excludedAppsSaved = telemetry?.excludedApps.join(', ')
useEffect(() => {
if (!telemetry) return
setExcludedApps(telemetry.excludedApps.join(', '))
}, [telemetry])
if (excludedAppsSaved === undefined) return
setExcludedApps(excludedAppsSaved)
}, [excludedAppsSaved])
// 설정 파일에 굳은 실제 값을 그대로 보여준다 (하드코딩 기본값을 표시하면
// 사용자가 보는 값과 동작이 어긋난다 — 실측: 트리거가 3008ms 로 저장돼 있었다).