From a4a2fc3ae74c1c019f2b0e8f21bfef28cd7d7295 Mon Sep 17 00:00:00 2001 From: egg Date: Wed, 10 Dec 2025 20:26:16 +0800 Subject: [PATCH] fix: Preserve form content when adding/removing conclusions and actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync DOM values to currentMeeting object before re-rendering when user clicks Add or Remove buttons. Previously, typed content was lost because render functions read from the data model which wasn't updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- client/src/pages/meeting-detail.html | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/client/src/pages/meeting-detail.html b/client/src/pages/meeting-detail.html index e7df113..873792c 100644 --- a/client/src/pages/meeting-detail.html +++ b/client/src/pages/meeting-detail.html @@ -534,23 +534,64 @@ `).join(''); } + // Save current form values to currentMeeting before re-rendering + function syncConclusionsFromDOM() { + document.querySelectorAll('.conclusion-content').forEach(textarea => { + const index = parseInt(textarea.dataset.index); + if (currentMeeting.conclusions && currentMeeting.conclusions[index]) { + currentMeeting.conclusions[index].content = textarea.value; + } + }); + } + + function syncActionsFromDOM() { + document.querySelectorAll('.action-content').forEach(textarea => { + const index = parseInt(textarea.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].content = textarea.value; + } + }); + document.querySelectorAll('.action-owner').forEach(input => { + const index = parseInt(input.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].owner = input.value; + } + }); + document.querySelectorAll('.action-due').forEach(input => { + const index = parseInt(input.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].due_date = input.value || null; + } + }); + document.querySelectorAll('.action-status').forEach(select => { + const index = parseInt(select.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].status = select.value; + } + }); + } + window.removeConclusion = function(index) { + syncConclusionsFromDOM(); currentMeeting.conclusions.splice(index, 1); renderConclusions(); }; window.removeAction = function(index) { + syncActionsFromDOM(); currentMeeting.actions.splice(index, 1); renderActions(); }; addConclusionBtn.addEventListener('click', () => { + syncConclusionsFromDOM(); if (!currentMeeting.conclusions) currentMeeting.conclusions = []; currentMeeting.conclusions.push({ content: '' }); renderConclusions(); }); addActionBtn.addEventListener('click', () => { + syncActionsFromDOM(); if (!currentMeeting.actions) currentMeeting.actions = []; currentMeeting.actions.push({ content: '', owner: '', due_date: null, status: 'Open' }); renderActions();