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 로 저장돼 있었다).

View file

@ -2532,6 +2532,8 @@
"tools.templates.deleted": "Deleted template '{{name}}'.",
"tools.templates.startItem": "Start {{name}}",
"tools.templates.removeField": "Remove field {{n}}",
"tools.templates.saveFailed": "Couldn't save the template: {{reason}}",
"tools.templates.startFailed": "Couldn't start the template: {{reason}}",
"tools.dictionary.description": "Dictation uses these words as recognition hints (up to 50).",
"tools.dictionary.add": "Add word",
"tools.dictionary.search": "Search words",

View file

@ -2539,6 +2539,8 @@
"tools.templates.deleted": "'{{name}}' 템플릿을 삭제했습니다.",
"tools.templates.startItem": "{{name}} 시작",
"tools.templates.removeField": "{{n}}번 필드 삭제",
"tools.templates.saveFailed": "템플릿을 저장하지 못했습니다: {{reason}}",
"tools.templates.startFailed": "템플릿을 시작하지 못했습니다: {{reason}}",
"tools.dictionary.description": "받아쓰기가 이 단어들을 먼저 알아듣도록 인식 힌트로 씁니다(최대 50개).",
"tools.dictionary.add": "단어 추가",
"tools.dictionary.search": "단어 검색",