useAccountabilityPrefill
Source:hooks/useAccountabilityPrefill.ts (56 lines)
The useAccountabilityPrefill hook auto-populates penalty and waiver fields on the task draft from the user’s saved accountability preset, providing a zero-friction commitment creation experience.
Flow
- On mount, checks if the user has a saved accountability preset in Convex
- If a preset exists AND the draft’s isAccountabilityPrefilled flag is false:
- Copies the preset’s penalty config into the draft’s penalty field
- Copies the preset’s waiver config into the draft’s penalty_waiver field
- Sets isAccountabilityPrefilled to true
- If no preset exists, does nothing (user configures manually)