managarten/apps/mana/apps/web/src/lib/modules/chat
Till JS ff6118fc3b fix(mana/web): migrate liveQuery hooks to useLiveQueryWithDefault
Seven module query files were calling raw `liveQuery(async () => ...)`
from dexie and returning the resulting Observable<T>. Consumer code in
the route .svelte files then read `.value` (or `.current`) on those
observables, which doesn't exist on the Dexie type — TypeScript flagged
38 errors and the call sites were silently relying on a runtime
property that only happens to work because the Svelte reactivity layer
re-evaluates the access.

Migration: switch each `useXxx()` hook to wrap with the existing
`useLiveQueryWithDefault` from `@mana/local-store/svelte`. The wrapper
returns `{ value, loading, error }` (with `value` synced to a `$state`
under the hood), so call sites can read `.value` reactively without
casts. Each hook now provides a typed default array so the wrapper
infers the right shape on first render.

Modules migrated:
  - chat        — useAllConversations, useArchivedConversations,
                  useAllTemplates, useConversationMessages
  - citycorners — useAllCities, useAllLocations, useAllFavorites
  - memoro      — useAllMemos, useArchivedMemos, useMemoriesByMemo,
                  useAllMemoTags, useAllSpaces
  - nutriphi    — useAllMeals, useAllGoals, useAllFavorites
  - presi       — useAllDecks, useDeckSlides, useDeck
  - questions   — useAllCollections, useAllQuestions,
                  useAnswersByQuestion
  - skilltree   — useAllSkills, useAllActivities, useAllAchievements

Call sites cleaned up:
  - chat/[id], memoro/[id]: removed inline `as { value: T[] }` casts
    that were the workaround for the broken type
  - nutriphi/{,add,goals,history}/+page.svelte: `.current ?? []` →
    `.value` (the wrapper guarantees the default array, so the
    nullish coalesce was always dead)
  - questions/{,[id],new,collections}/+page.svelte: same `.current` →
    `.value` migration

Net: -38 type errors, no behavior change. The wrappers continue to
subscribe to the same Dexie liveQuery under the hood; only the
ergonomic surface changed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 18:12:15 +02:00
..
stores feat(mana/web): encryption phase 5 — rollout to chat/dreams/memoro/contacts/cycles/finance 2026-04-07 19:28:26 +02:00
collections.ts feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
index.ts feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
ListView.svelte refactor(mana/web): consolidate ListView scaffolding into BaseListView 2026-04-08 18:40:47 +02:00
module.config.ts fix(mana/web): commit module-registry + module.config.ts files (build-critical) 2026-04-07 19:49:58 +02:00
queries.ts fix(mana/web): migrate liveQuery hooks to useLiveQueryWithDefault 2026-04-09 18:12:15 +02:00
types.ts fix(mana/web): sprint 2 — auth-aware data layer + guest migration 2026-04-07 13:07:12 +02:00