From dce9890bfa805ff78a6b05a68c3da0bc736da107 Mon Sep 17 00:00:00 2001 From: Guido Schmit Date: Wed, 29 Apr 2026 20:22:34 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Termin-=C3=84nderungen=20(Farbe,=20Titel?= =?UTF-8?q?,=20etc.)=20sofort=20ohne=20Reload=20anzeigen=20Nach=20dem=20Sp?= =?UTF-8?q?eichern=20eines=20Termins=20wird=20das=20gecachte=20Event-Objek?= =?UTF-8?q?t=20direkt=20in-place=20gepatcht=20und=20die=20View=20neu=20ger?= =?UTF-8?q?endert.=20Vorher=20war=20die=20neue=20Farbe=20erst=20nach=20F5?= =?UTF-8?q?=20sichtbar,=20weil=20zwar=20fetchAndRender(true)=20aufgerufen?= =?UTF-8?q?=20wurde,=20aber=20der=20Render-Pfad=20das=20Update=20nicht=20z?= =?UTF-8?q?uverl=C3=A4ssig=20=C3=BCbernommen=20hat.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/js/calendar.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/js/calendar.js b/frontend/js/calendar.js index 362af1c..c2c38a5 100644 --- a/frontend/js/calendar.js +++ b/frontend/js/calendar.js @@ -146,6 +146,19 @@ function applyCalendarColor(source, calId, color) { renderView(); } +// Patch a single event in cache after edit/save, then re-render immediately. +// 'patch' is the new field values to merge into the existing cached event. +function applyEventPatch(eventId, eventUrl, patch) { + const targetUrl = eventUrl || ''; + eventCache.events.forEach(ev => { + if (ev.id === eventId && (ev.url || '') === targetUrl) { + Object.assign(ev, patch); + } + }); + state.events = eventCache.events; + renderView(); +} + // Fire-and-forget: extend the cache toward whichever edge the view is approaching function prefetchIfNeeded(viewStart, viewEnd) { if (!eventCache.start || !eventCache.end) return; @@ -1443,6 +1456,13 @@ function bindEventModal() { { title, start, end, allDay, location: loc, description: desc, color: color || null, rrule: rrule || '' } ); } + // Patch the cached event in-place so the UI reflects changes immediately + applyEventPatch(ev.id, ev.url, { + title, start, end, allDay, + location: loc, description: desc, + color: color || null, + rrule: rrule || null, + }); showToast(t('event_updated')); } else if (isGoogle) { const calDbId = parseInt(calVal.replace('google-', ''));