Skip to Content

Developer reference

Use existing data hooks

Find the actual exported hook contract, handle its read state and invalidate the right results.

API hooks connect inquiry components to owned entity lists and financial read models. Their interfaces should be read from the current exports and mounted callers, not inferred from an older feature name.

Find the hook before adding one

Inspect src/lib/api/hooks and the components that call it. Accounts, movements, obligations, people and imports already have transport and cache responsibilities. Reuse the relevant path instead of adding a second client fetch with independent lifetime rules.

Current hook entry points

ExportUse
useUserPreferencesOwned name/base-currency preferences.
useOverviewSituation read model and account evidence.
useObligationBoardUpcoming commitments.
useTransactionsPage(page)Bounded Activity page; the feed page size is 50.
useSubscriptionsRecurring relationships.
usePeoplePositionsMoney-and-people reading.
useIdentityDetail(id), useCounterpartyDetail(id), useGameyyaDetail(id)Owned detail reads with a nullable ID.
useSpendingByContext(period, date), useIncomeBreakdown(period, date)Period-based insight reads.
useReminders(userId, page)Owned paginated reminder occurrences.
invalidateFinancialQueries()Refresh related financial reads after a valid mutation.

useApiQuery is the shared transport/cache hook. Read its actual return type before introducing another caller.

Review its result

Check how the hook represents loading, unavailable, empty and ready. Read any evidence metadata returned by the server. A hook returning data does not by itself guarantee the full history or that a combined conversion is supported.

Mutation integration

When adding a command, identify which lists and summaries change. Use existing invalidation helpers so My Situation and the detailed account view do not disagree after the save.

A fictional EGP 150 purchase affects a movement list and an account’s financial answer. Updating only the list would leave the visible balance stale.

Identity and lifecycle

Keep responses tied to owned auth generations. On account retirement, a late query must not restore prior data. Do not preserve a hook cache merely because a route remains mounted.

For exact behavior, read the current hook and its tests before implementing. Continue with client data flow and test inventory.