-
Notifications
You must be signed in to change notification settings - Fork 0
stores
All Zustand state stores with their state shape and key actions. See Architecture for how stores relate to services.
Purpose: Manages the notes collection, selection, filtering, and CRUD operations.
State:
-
notes: Note[]— all loaded notes -
selectedNoteId: string | null— currently selected note -
filter: NoteFilter— active filter (folder, tag, color, search) -
sortOrder: SortOrder— current sort (updated, created, title, pin) -
viewMode: 'list' | 'grid'— list vs grid display isLoading: booleanerror: string | null
Key Actions: loadNotes, createNote, updateNote, deleteNote, selectNote, setFilter, setSortOrder
Purpose: Manages todo items, completion state, and filtering.
State:
todos: Todo[]selectedTodoId: string | nullfilter: TodoFiltersortOrder: SortOrderisLoading: booleanerror: string | null
Key Actions: loadTodos, createTodo, updateTodo, deleteTodo, toggleComplete, selectTodo
Purpose: Manages canvas documents and their local-first document lifecycle.
State:
canvases: Canvas[]isLoading: booleanerror: string | null
Key Actions: loadCanvases, createCanvas, updateCanvas, deleteCanvas, refreshCanvases, clearError
Purpose: Manages AI chat threads and messages.
State:
-
threads: ChatThreadSummary[]— loaded thread summaries -
activeThread: ChatThread | null— currently open thread (null if none) isLoading: booleanerror: string | nullisStreaming: booleanstorageAdapter: ChatStorageAdapter | null
Key Actions: loadThreads, loadThread, createThread, deleteThread, renameThread, addMessage, updateMessage, removeMessage, truncateAfter, setStreaming, clearActiveThread, clearError, setStorageAdapter
Purpose: Manages the repository collection, selected repo, and sync state.
State:
repos: Repo[]selectedRepoId: string | null-
syncState: SyncState— 'idle' | 'syncing' | 'error' lastSyncAt: number | nullpendingChanges: number
Key Actions: loadRepos, addRepo, removeRepo, selectRepo, triggerSync
Purpose: Configures the active AI provider, model, and chat context.
State:
provider: AIProvider | nullmodel: stringchatRepoOwner: string | nullchatRepoName: string | nullisConfigured: boolean
Key Actions: setProvider, setModel, setChatContext
Purpose: Manages Pro subscription state, entitlements, and paywall display.
State:
status: 'loading' | 'pro' | 'free'entitlementActive: booleantrialActive: booleantrialEndsAt: number | nullentitlementExpiresAt: number | nullofferingsReady: booleanmonthlyPackage: PurchasesPackage | nullyearlyPackage: PurchasesPackage | nulllifetimePackage: PurchasesPackage | nullcurrentOffering: PurchasesOffering | nullisPurchasing: booleanisRestoring: booleanerror: string | nullinterstitialEligible: booleanconfigured: boolean
Key Actions:
-
initialize— configures RevenueCat and resolves entitlement -
refresh— re-fetches customer info -
purchaseMonthly,purchaseYearly,purchaseLifetime -
restore— restores purchases from App Store loadOfferingsIfNeededmarkInterstitialShown-
bindAccount,unbindAccount
DEV_FORCE_PRO: In __DEV__ on iOS Simulator, Pro gate is forced open via EXPO_PUBLIC_FORCE_ENABLE_PRO_ON_SIMULATOR env var for QA testing without real IAP.
Purpose: Manages user accounts (GitHub, GitLab, etc.) and authentication tokens.
State:
accounts: Account[]activeAccountId: string | null
Key Actions: addAccount, removeAccount, setActiveAccount
Purpose: Manages folder tree and folder selection for note organization.
State:
folders: Folder[]selectedFolderPath: string | nullexpandedFolderIds: string[]
Key Actions: loadFolders, createFolder, deleteFolder, selectFolder
Purpose: Manages scheduled reminders for notes and todos.
State:
reminders: Reminder[]isLoading: boolean
Key Actions: loadReminders, createReminder, deleteReminder, snoozeReminder
Purpose: Manages note templates.
State:
templates: Template[]isLoading: boolean
Key Actions: loadTemplates, createTemplate, deleteTemplate, applyTemplate
Purpose: Manages per-note render style preferences (markdown, rich text, plaintext).
State:
defaultStyle: RenderStyleperNoteOverrides: Record<string, RenderStyle>
Key Actions: setDefaultStyle, setNoteOverride
Purpose: Manages sync conflicts requiring user resolution.
State:
conflicts: Conflict[]selectedConflictId: string | nullisResolving: boolean
Key Actions: loadConflicts, resolveConflict, dismissConflict
Purpose: Tracks recent git operations for display in the UI.
State:
recentCommits: Commit[]recentPushes: Push[]unpushedCount: number
Key Actions: recordCommit, recordPush, clearHistory
Purpose: Controls visibility and state of the floating git sync button.
State:
visible: booleanhydrated: booleanunpushedCount: number
Key Actions: show, hide, hydrate
Purpose: Tracks in-flight git operations for progress display.
State:
operations: GitOperation[]isAnyRunning: boolean
Key Actions: startOperation, endOperation, cancelOperation
Purpose: Stores unsaved edits as drafts for recovery.
State:
-
drafts: Record<string, string>— noteId → draft content lastSavedAt: Record<string, number>
Key Actions: saveDraft, loadDraft, clearDraft
Purpose: Manages AI Hub (multi-provider AI chat) state and picker visibility.
State:
pickerVisible: booleanselectedProviders: AIProvider[]
Key Actions: openPicker, closePicker, selectProvider
Purpose: Tracks GitHub notifications and activity for the Explore screen.
State:
notifications: GitHubNotification[]lastFetchedAt: number | null
Key Actions: fetchNotifications, markRead
Purpose: Queues actions triggered by the floating git button (push, pull, sync).
State:
queuedAction: GitButtonAction | nullisHolding: booleanholdProgress: number
Key Actions: queueAction, setHolding, setProgress
- Services — Business logic layer that updates stores
- Architecture — Overall data flow
- Screens — UI components that consume stores