From e896d91681669c84b4c8aa4527a01c7c1066ce5c Mon Sep 17 00:00:00 2001 From: Etienne Delvarre Date: Fri, 29 May 2026 14:41:53 +0200 Subject: [PATCH] fix: update visionData cache immediately before network save Prevents stale reads when renderMoodboard runs after saveVisionSection Co-Authored-By: Claude Opus 4.6 --- public/index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 3110f45..5a0ecbb 100644 --- a/public/index.html +++ b/public/index.html @@ -1013,13 +1013,12 @@ function showSaved() { async function saveVisionSection(section, contenu) { const row = visionData[section]; if (!row) return; - await fetch(`/api/vision/${row.Id}`, { + row.Contenu = contenu; // update local cache immediately + fetch(`/api/vision/${row.Id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ Contenu: contenu }), - }); - row.Contenu = contenu; - showSaved(); + }).then(() => showSaved()); } function setupEditable(elId, section) {