From dde33acdf2033ba31b2e3444870f067d547860ff Mon Sep 17 00:00:00 2001 From: medic-bot Date: Thu, 12 Mar 2026 19:48:14 -0400 Subject: [PATCH] fix: show all tasks in widget without date or count limits Remove the 2-week date filter from widget task query so tasks with distant due dates are included. Remove the maxItems truncation from the scrollable ListWidget so the displayed list matches the counter. Co-Authored-By: Claude Opus 4.6 --- src/services/widgetSync.ts | 8 +++----- src/widgets/TaskListWidget.tsx | 9 ++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/services/widgetSync.ts b/src/services/widgetSync.ts index e60c623..9d0efdc 100644 --- a/src/services/widgetSync.ts +++ b/src/services/widgetSync.ts @@ -4,7 +4,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; import { db } from '../db/client'; import { tasks, lists } from '../db/schema'; import { eq, and, isNull, gte, lte, lt, asc, sql } from 'drizzle-orm'; -import { startOfDay, endOfDay, addWeeks } from 'date-fns'; +import { startOfDay } from 'date-fns'; import { TaskListWidget } from '../widgets/TaskListWidget'; export const WIDGET_DATA_KEY = 'widget:tasks'; @@ -34,7 +34,6 @@ export async function syncWidgetData(): Promise { try { const now = new Date(); const todayStart = startOfDay(now); - const twoWeeksEnd = endOfDay(addWeeks(now, 2)); const selectFields = { id: tasks.id, @@ -48,7 +47,7 @@ export async function syncWidgetData(): Promise { subtaskDoneCount: sql`(SELECT COUNT(*) FROM tasks AS sub WHERE sub.parent_id = ${tasks.id} AND sub.completed = 1)`.as('subtask_done_count'), }; - // Fetch tasks with due date in the next 2 weeks + // Fetch all upcoming tasks (today and future) const upcomingTasks = await db .select(selectFields) .from(tasks) @@ -57,8 +56,7 @@ export async function syncWidgetData(): Promise { and( eq(tasks.completed, false), isNull(tasks.parentId), - gte(tasks.dueDate, todayStart), - lte(tasks.dueDate, twoWeeksEnd) + gte(tasks.dueDate, todayStart) ) ) .orderBy(asc(tasks.dueDate)); diff --git a/src/widgets/TaskListWidget.tsx b/src/widgets/TaskListWidget.tsx index ccfe348..ab9360f 100644 --- a/src/widgets/TaskListWidget.tsx +++ b/src/widgets/TaskListWidget.tsx @@ -380,17 +380,14 @@ function SmallWidget({ tasks, isDark }: { tasks: WidgetTask[]; isDark: boolean } function ListWidgetContent({ tasks, - maxItems, isDark, expandedTaskIds, }: { tasks: WidgetTask[]; - maxItems: number; isDark: boolean; expandedTaskIds: Set; }) { const c = getColors(isDark); - const displayTasks = tasks.slice(0, maxItems); return ( {/* Task list */} - {displayTasks.length > 0 ? ( + {tasks.length > 0 ? ( - {displayTasks.map((task) => ( + {tasks.map((task) => ( ; } - const maxItems = widgetName === 'SimplListeLarge' ? 8 : 4; return (