Skip to main content

Task Draft Store

The useTaskDraftStore is the largest Zustand store in the application (~800 lines, 26KB). It holds the entire state of a commitment being created or edited in the wizard flow.

Core Type

The store manages a single TaskDraft object that mirrors the Convex schema with UI-only extensions:
All types are derived directly from the Convex schema via Doc types, ensuring type safety across the stack.

Key Actions


Logger Middleware

Every state mutation is logged with a pretty-printed JSON dump of the full draft. This provides complete visibility during development without external devtools.

Slot-Level Conditions

The most complex feature is per-slot condition management. Each time_window in the recurrence object can have its own independent conditions array, allowing different locations, blocklists, and rules for different time slots within the same commitment.