From 28327781759fe64a9377e60069b3d344008644f1 Mon Sep 17 00:00:00 2001 From: Ridanshi Date: Tue, 19 May 2026 22:28:23 +0530 Subject: [PATCH] fix: update summary box when task data loads. The daily/weekly summary was computed once at module-load time, before store.fetchInitialData() had been called, so store.tasks and store.subjects were both empty arrays. The summary therefore always displayed "Today you have 0 task(s). Focus on no specific subject." regardless of how many tasks the user had added. Wraps the summary update in a renderSummary() function and registers it as a store subscriber alongside the other render functions, so it re-renders with real data as soon as the initial fetch completes and on every subsequent store change. --- js/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/app.js b/js/app.js index 9bfd993..69a662d 100644 --- a/js/app.js +++ b/js/app.js @@ -663,9 +663,11 @@ function renderTasks() { } -const summaryBox = document.getElementById('summary-box'); -if (summaryBox) { - summaryBox.innerHTML = generateSummary(store.tasks, store.subjects); +function renderSummary() { + const summaryBox = document.getElementById('summary-box'); + if (summaryBox) { + summaryBox.innerHTML = generateSummary(store.tasks, store.subjects); + } } function renderCalendar() { @@ -855,6 +857,7 @@ store.subscribe(renderExtraction); store.subscribe(renderCalendar); store.subscribe(renderFocusTasks); store.subscribe(renderSidebarSubjects); +store.subscribe(renderSummary); document.addEventListener('DOMContentLoaded', () => { if (newSubjectColorsEl) {