Skip to main content

useTasks

Source: hooks/commits/useTasks.ts (54 lines) The useTasks hook fetches all tasks assigned to the current user from the Convex backend using a real-time reactive query, sorts them by recency, and synchronizes the result to the global useTaskStore for cross-screen access.

Data Source

Unlike most hooks in the app that read from local SQLite, useTasks queries the Convex backend directly via the reactive useQuery hook:
The “skip” sentinel prevents unauthenticated queries from firing before the session is resolved.

Global Store Synchronization

After fetching, the hook pushes data into the global Zustand store for snappier cross-screen access:
This allows screens like the Calendar and Notifications tabs to read task metadata without their own Convex subscription.

Sorting

Tasks are sorted by most recently updated/created in descending order:

Return Value