From 9a8bb13e972612636e5b27a073bf9ff39d1bbb77 Mon Sep 17 00:00:00 2001 From: le king fu Date: Thu, 12 Mar 2026 20:20:47 -0400 Subject: [PATCH] fix: cap widget task list at 30 items to prevent memory issues Add safety limit of 30 rendered tasks in the widget to avoid Android memory constraints. Also add cross-reference comment for the implicit AsyncStorage coupling with useSettingsStore. Co-Authored-By: Claude Opus 4.6 --- src/services/widgetSync.ts | 1 + src/widgets/TaskListWidget.tsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/widgetSync.ts b/src/services/widgetSync.ts index c5cf4c1..38755dd 100644 --- a/src/services/widgetSync.ts +++ b/src/services/widgetSync.ts @@ -36,6 +36,7 @@ export async function syncWidgetData(): Promise { const todayStart = startOfDay(now); // Read widget period setting from AsyncStorage (0 = all, N = N weeks ahead) + // Coupled with useSettingsStore.ts — key 'simpl-liste-settings', path state.widgetPeriodWeeks let widgetPeriodWeeks = 0; try { const settingsRaw = await AsyncStorage.getItem('simpl-liste-settings'); diff --git a/src/widgets/TaskListWidget.tsx b/src/widgets/TaskListWidget.tsx index ab9360f..c084192 100644 --- a/src/widgets/TaskListWidget.tsx +++ b/src/widgets/TaskListWidget.tsx @@ -473,7 +473,7 @@ function ListWidgetContent({ - {/* Task list */} + {/* Task list — cap at 30 items to avoid Android widget memory limits */} {tasks.length > 0 ? ( - {tasks.map((task) => ( + {tasks.slice(0, 30).map((task) => (