Bug #3 (HIGH): New habit button on /habits did not open the create
dialog. The HabitCreateDialog was mounted but the topbar's
useCreateDialogStore had no consumer on /habits, so topbar clicks
were no-ops.
Bug #4 (HIGH): New project button on /projects had the same issue.
Fix: mount CreateItemDialog (type=habit or type=project) on each
page so the topbar store is consumed. Switch the page-level button
to use the store too. The existing local HabitCreateDialog /
ProjectCreateDialog still work as a fallback.
Bug #5 (HIGH): Domain Add button on /settings/domains opened the
Command Palette instead of creating the domain. Two-part cause:
1. The sticky topbar Quick add button was visually overlapping
the form Add button (both anchored top-right). On click the
topbar handleCreate fired and dispatched a synthetic Cmd+K
opening the palette.
2. /api/domains POST required a slug field that the form did not
send, returning 400.
Fix: hide the topbar Quick add button on pages without a relevant
quick-create (only show on /projects, /habits, /tasks). Make the
form Add button explicit type=button with stopPropagation as
defense in depth. Auto-generate the domain slug from the name
on the server when not provided.
Bug #3 + Bug #4 + Bug #5 all fixed in this commit.
- New resolveActiveDomain() helper in apps/web/lib/auth.ts: returns the
user's first existing domain (ordered by sort_order then created_at),
or auto-creates a default 'Personal' domain if they have none.
- 7 affected API routes (agents, canvases, domains, habits, projects,
search, tasks) now fall back to resolveActiveDomain when the request
omits a domain param. This eliminates the UNDEFINED_VALUE on domain_id
and 22P02 invalid uuid errors that broke 6+ UI flows.
- New POST /api/quick-capture route: switches on type=task|habit|note|project
to create the right entity, after resolving the active domain. This is
the API the dashboard quick-capture widget calls.
- packages/db/src/schema.ts: added ownerId: uuid('owner_id') to the
domains table so each user owns their domains.
- drizzle/0004_add_owner_id_to_domains.sql: matching migration with
column add + index.
- apps/web/__tests__/lib/auth.test.ts: unit tests for both branches of
resolveActiveDomain (returns existing / creates Personal).
- apps/web/app/(dashboard)/canvas/page.tsx: removed hardcoded
domain: 'personal' from the quick-create payload so server-side
resolution can do its job.
This unblocks all of: /tasks, /habits, /projects, /search, /settings/agents,
/settings/domains, /canvas, and dashboard quick-capture.
- Tasks REST API under /api/domains/[domainId]/tasks/ with full CRUD, filtering, pagination
- Complete/uncomplete endpoints
- Bulk update endpoint for drag-to-reorder
- Dependencies API with cycle detection
- Tags API for task tagging
- Activity feed API scoped to workspace
- Updated kanban board view with 4 columns (todo/in_progress/done/cancelled)
- Updated list view with status column and workspace-scoped API calls
- Task create dialog with title, description, status, priority, due date, estimate
- Task detail panel (sheet) with full edit capabilities
- Task activity feed widget
- Keyboard shortcuts: c t (new task), e (edit), d (delete), Space (open), Esc (close), 1-4 (filter)
- All routes follow AGENTS.md contract: Drizzle writes + activity feed + pg_notify