fix: update visionData cache immediately before network save

Prevents stale reads when renderMoodboard runs after saveVisionSection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Etienne Delvarre
2026-05-29 14:41:53 +02:00
parent 0512a11d86
commit e896d91681
+3 -4
View File
@@ -1013,13 +1013,12 @@ function showSaved() {
async function saveVisionSection(section, contenu) { async function saveVisionSection(section, contenu) {
const row = visionData[section]; const row = visionData[section];
if (!row) return; if (!row) return;
await fetch(`/api/vision/${row.Id}`, { row.Contenu = contenu; // update local cache immediately
fetch(`/api/vision/${row.Id}`, {
method: 'PATCH', method: 'PATCH',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ Contenu: contenu }), body: JSON.stringify({ Contenu: contenu }),
}); }).then(() => showSaved());
row.Contenu = contenu;
showSaved();
} }
function setupEditable(elId, section) { function setupEditable(elId, section) {