From 90bc4b15311346335a9bd59a71d1c1da9edf2389 Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Mon, 6 Jul 2026 21:44:32 +0200 Subject: [PATCH] fix(web): bind UI handlers before first fetch so a data error can't kill the UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit initCalendar() awaited fetchAndRender() BEFORE binding the topbar/settings/menu handlers, so any error from /caldav/events (e.g. a transient 500) threw out of init and left the buttons dead — the reported "settings won't open". Same root cause as the reload-logout bug: app wiring must not depend on event data loading. Bind all handlers first, then fetch inside try/catch (errors are logged + shown as a toast, no longer fatal). v75. Co-Authored-By: Claude Opus 4.8 --- frontend/js/calendar.js | 11 ++++++++++- frontend/js/version.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/js/calendar.js b/frontend/js/calendar.js index f65e6ff..428e53b 100644 --- a/frontend/js/calendar.js +++ b/frontend/js/calendar.js @@ -135,7 +135,10 @@ export async function initCalendar() { updateViewButtons(); renderCalendarList(); renderMiniCal(); - await fetchAndRender(); + // Bind all UI handlers BEFORE the first data fetch. Otherwise a failing + // /caldav/events (e.g. a transient server error) would throw out of + // initCalendar and leave the topbar/settings/menu buttons dead — the + // "settings won't open" bug. Handlers must not depend on event data loading. bindTopbar(); bindSidebar(); bindEventModal(); @@ -149,6 +152,12 @@ export async function initCalendar() { bindSwipeNavigation(); handleHAOAuthReturn(); loadGroups(); + try { + await fetchAndRender(); + } catch (e) { + console.error('Initial fetchAndRender failed', e); + showToast(t('unknown_error'), true); + } // Reopen the settings modal after a reload if the URL says we were in it. if (urlState.settings) openSettingsModal(); diff --git a/frontend/js/version.js b/frontend/js/version.js index c2145f5..5919ad7 100644 --- a/frontend/js/version.js +++ b/frontend/js/version.js @@ -1,2 +1,2 @@ // Increment APP_VERSION with every code change -export const APP_VERSION = 'v74'; +export const APP_VERSION = 'v75';