personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Replace reload-after-save with optimistic in-place UI updates in speakers app

Remove delayed full sentence reloads after save/create voiceprint actions.

Update the affected sentence row in place by:
- setting the confirmed match label with checkmark
- disabling save controls to prevent double-save
- hiding the inline create form after successful creation
- inserting new entities into all speaker dropdowns (duplicate-safe via option iteration)

This eliminates both setTimeout(() => loadSentences(...), 1500) calls in saveVoiceprint and createEntityWithVoiceprint.

+27 -4
+27 -4
apps/speakers/workspace.html
··· 981 981 showStatus(row, data.error, 'error'); 982 982 } else { 983 983 showStatus(row, `Saved to ${entityName}`, 'success'); 984 - // Reload to refresh matches 985 - setTimeout(() => loadSentences(selectedSegment, selectedSource), 1500); 984 + // Update match display to show confirmed state 985 + const matchEl = row.querySelector('.spk-sentence-match'); 986 + matchEl.innerHTML = `<span class="spk-match-label spk-match-high">${escapeHtml(entityName)} &#10003;</span>`; 987 + // Disable save controls to prevent double-save 988 + const select = row.querySelector('.spk-entity-select'); 989 + if (select) select.disabled = true; 990 + const saveBtn = row.querySelector('.spk-save-btn'); 991 + if (saveBtn) saveBtn.disabled = true; 986 992 } 987 993 }) 988 994 .catch(() => { ··· 1012 1018 showStatus(row, `Created ${name}`, 'success'); 1013 1019 const form = row.querySelector('.spk-inline-form'); 1014 1020 form.classList.remove('visible'); 1015 - // Reload to refresh matches and entity list 1016 - setTimeout(() => loadSentences(selectedSegment, selectedSource), 1500); 1021 + // Update match display to show confirmed state 1022 + const matchEl = row.querySelector('.spk-sentence-match'); 1023 + matchEl.innerHTML = `<span class="spk-match-label spk-match-high">${escapeHtml(name)} &#10003;</span>`; 1024 + // Disable save controls to prevent double-save 1025 + const select = row.querySelector('.spk-entity-select'); 1026 + if (select) select.disabled = true; 1027 + const saveBtn = row.querySelector('.spk-save-btn'); 1028 + if (saveBtn) saveBtn.disabled = true; 1029 + // Add new entity to all dropdowns so other rows can use it 1030 + document.querySelectorAll('.spk-entity-select').forEach(sel => { 1031 + const newOption = sel.querySelector('option[value="__new__"]'); 1032 + const exists = Array.from(sel.options).some(o => o.value === name); 1033 + if (!exists && newOption) { 1034 + const opt = document.createElement('option'); 1035 + opt.value = name; 1036 + opt.textContent = name; 1037 + sel.insertBefore(opt, newOption); 1038 + } 1039 + }); 1017 1040 } 1018 1041 }) 1019 1042 .catch(() => {