Phase 1: NoteEditor Split (64KB → 9 focused components) - components/note-editor/: types.ts, context, toolbar, title-block, content-area, metadata-section, full-page, dialog compositions - Maintains backwards compatibility via re-export from note-editor.tsx Phase 2: Context Consolidation (5 → 3 contexts) - NotebooksContext absorbs LabelContext (labels CRUD) - EditorUIContext merges HomeViewContext + NotebookDragContext - Removed: LabelContext, home-view-context, notebook-drag-context Phase 3: React Query Infrastructure - Added QueryProvider with @tanstack/react-query - lib/query-keys.ts: centralized query key definitions - lib/query-hooks.ts: useNotes, useNotebooksQuery, useLabelsQuery - lib/use-refresh.ts: hybrid invalidateQueries + triggerRefresh helper - NotebooksContext: invalidateQueries on mutations (with triggerRefresh fallback) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
24 lines
879 B
TypeScript
24 lines
879 B
TypeScript
// React Query query keys
|
|
|
|
export const queryKeys = {
|
|
// Notes
|
|
notes: (notebookId?: string | null) => ['notes', notebookId] as const,
|
|
note: (noteId: string) => ['note', noteId] as const,
|
|
notesWithReminders: () => ['notes', 'reminders'] as const,
|
|
noteHistory: (noteId: string) => ['note', noteId, 'history'] as const,
|
|
|
|
// Notebooks
|
|
notebooks: () => ['notebooks'] as const,
|
|
notebook: (notebookId: string) => ['notebooks', notebookId] as const,
|
|
|
|
// Labels
|
|
labels: (notebookId?: string | null) => ['labels', notebookId] as const,
|
|
|
|
// AI
|
|
aiSettings: (userId: string) => ['ai', 'settings', userId] as const,
|
|
titleSuggestions: (content: string) => ['ai', 'title-suggestions', content] as const,
|
|
autoTags: (content: string, notebookId?: string | null) => ['ai', 'auto-tags', content, notebookId] as const,
|
|
} as const
|
|
|
|
export type QueryKeys = typeof queryKeys
|