Files
gtd/app/src/lib/useStore.ts
Marcus Rehbock ad16522461
All checks were successful
Build & Release APK / build (push) Successful in 10m54s
Local-first sync: on-device store + offline mutation queue, idempotent server upserts
Screens render synchronously from an AsyncStorage-backed store; every
mutation applies locally and drains to the API in the background
(last-write-wins, client-generated UUIDs). Sydney round-trips are off the
interaction path and the app works fully offline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 19:19:51 -07:00

9 lines
361 B
TypeScript

import { useSyncExternalStore } from "react";
import { getState, subscribe, type State } from "./store";
// Subscribe a component to the local-first store. The whole state object is
// the snapshot (replaced immutably on every change), so derive lists inline.
export function useStore(): State {
return useSyncExternalStore(subscribe, getState, getState);
}