refactored localchecklist primitive into a store#241
Conversation
📝 WalkthroughWalkthroughThis PR migrates local checklist state management from a custom hook ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
corates | ca5f112 | Commit Preview URL | Jan 07 2026, 04:10 AM |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/web/src/stores/localChecklistsStore.js (2)
17-49: Consider addingonblockedhandler for IndexedDB.When another tab has an older version of the database open, the upgrade can be blocked. Without handling this, users may experience silent failures.
🔎 Proposed fix
dbInitPromise = new Promise((resolve, reject) => { const request = indexedDB.open(DB_NAME, DB_VERSION); request.onerror = () => { dbInitPromise = null; reject(request.error); }; + request.onblocked = () => { + console.warn('Database upgrade blocked. Please close other tabs using this app.'); + }; + request.onsuccess = () => { dbInstance = request.result; resolve(dbInstance); };
91-125: Redundant property assignment in checklist creation.Lines 103-111 spread
templateand then explicitly re-assignid,name, andchecklistTypewhich are already set intemplate(percreateChecklistOfTypeat line 96-101 and the registry snippet). While this works as an intentional override,createdAtis passed to the template but then overwritten with the same value.🔎 Simplified version
const template = createChecklistOfType(type, { id, name, createdAt: now, reviewerName: '', }); const checklist = { ...template, - id, - name, - checklistType: type, - createdAt: now, updatedAt: now, isLocal: true, };
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/primitives/useLocalChecklists.jspackages/web/src/stores/localChecklistsStore.js
💤 Files with no reviewable changes (1)
- packages/web/src/primitives/useLocalChecklists.js
🧰 Additional context used
📓 Path-based instructions (18)
packages/web/src/**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/form-state.mdc)
packages/web/src/**/*.{js,jsx}: Save form state to IndexedDB before initiating OAuth redirects (Google Drive, ORCID) using saveFormState() with form type ('createProject' or 'addStudies') and serializable state only
Only save serializable data to IndexedDB—exclude File objects, ArrayBuffers, functions, and other non-serializable objects from form state persistence
Restore form state after OAuth redirects by checking URL restore params with getRestoreParamsFromUrl(), retrieving saved state with getFormState(), restoring to form, clearing saved state with clearFormState(), and clearing URL params with clearRestoreParamsFromUrl()
For temporary File object storage during OAuth flows (e.g., pending PDFs), use projectStore.setPendingProjectData() instead of IndexedDB, as File objects cannot be serialized
Add restore parameters to the URL after OAuth redirects in the format '?restore=&projectId=' to signal form state restoration on mount
Clear URL restore parameters after form state restoration by calling clearRestoreParamsFromUrl() to prevent stale restoration attempts on subsequent navigation
Form state persistence library functions (saveFormState, getFormState, clearFormState, getRestoreParamsFromUrl, clearRestoreParamsFromUrl) are implemented in packages/web/src/lib/formStatePersistence.js and should be imported from @/lib/formStatePersistence.js
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/pdf-handling.mdc)
packages/web/src/**/*.{js,jsx,ts,tsx}: Always useuploadPdffrom@api/pdf-api.jsfor uploading PDF files. Pass object with projectId, studyId, tag ('primary' or 'supplementary'), and fileName
Validate PDF files on frontend by checking file.type includes 'pdf' and file.size is within MAX_PDF_SIZE limit (full validation is done on backend)
UsecachePdfandgetCachedPdffrom@primitives/pdfCache.jsfor caching PDF data in IndexedDB
Implement PDF caching strategy: check cache first, download from server if not cached, then cache the downloaded PDF
Store only PDF metadata in Yjs (id, name, size, tag, uploadedAt, uploadedBy), never store PDF binary data in Yjs as it is too large
UseimportFromGoogleDrivefrom@api/google-drive.jsfor importing PDFs from Google Drive. Pass fileId, projectId, studyId, and tag
Save form state usingsaveFormStatefrom@/lib/formStatePersistence.jsbefore triggering OAuth redirects for Google Drive
UseaddPdfToStudyoperation fromuseProjecthook to add PDFs to a study, passing id, name, size, tag, uploadedAt, and uploadedBy
UseremovePdfFromStudyoperation fromuseProjecthook to remove PDFs from a study
UsepdfPreviewStorefrom@/stores/pdfPreviewStore.jsfor managing PDF preview state (openPreview, closePreview, getPreview methods)
UsedownloadPdffrom@api/pdf-api.jsto download PDFs from server, then cache the result usingcachePdf
Always cache PDFs after download and check cache before downloading to avoid redundant downloads
Use PDF operations fromuseProjecthook instead of bypassing through direct API calls
packages/web/src/**/*.{js,jsx,ts,tsx}: For UI icons, usesolid-iconslibrary or SVGs only (never emojis)
Use import aliases from jsconfig.json (see ui-components.mdc)
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/src/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/pdf-handling.mdc)
Use
PdfViewercomponent from@/components/checklist-ui/pdf/PdfViewer.jsxfor displaying PDFs, passing pdfData as ArrayBuffer, fileName, readOnly, and onPageChange
packages/web/src/**/*.{jsx,tsx}: Do NOT prop-drill application state - Import stores directly where needed
Do NOT destructure props - Accessprops.fielddirectly or wrap in function:() => props.field
Components should receive at most 1-5 props (local config only, not shared state)
Move business logic to stores, utilities, or primitives (not components)
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
{packages/web/**,packages/landing/**}/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/solidjs.mdc)
{packages/web/**,packages/landing/**}/**/*.{jsx,tsx}: NEVER destructure props in SolidJS components - access props directly or wrap in functions to maintain reactivity
Use external stores in packages/web/src/stores/ for shared/cross-feature state instead of prop-drilling
Keep SolidJS components lean and focused on rendering - move business logic to stores, primitives, or utilities
Create reusable logic in primitives (hooks) in packages/web/src/primitives/ and import them into components
Use Solid's Show component for conditional rendering instead of ternary operators
Use Solid's For component for rendering lists instead of Array.map()
Use the children helper when manipulating props.children in SolidJS components
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
{packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/solidjs.mdc)
{packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx}: Use createSignal for simple reactive values in SolidJS components
Use createStore for complex objects and arrays that need granular reactivity in SolidJS
Use createMemo for computed/derived values that depend on reactive state in SolidJS
Always clean up SolidJS effects that create subscriptions or timers using onCleanup
Import stores directly in components and use store read/write action pattern - read from store, write via actions store
Prefer derived state with createMemo or signals over effects whenever possible
Use local createSignal or createStore for local component state; use external stores for shared/cross-feature state
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/{web,ui}/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
packages/{web,ui}/**/*.{js,jsx,ts,tsx}: Import UI components from '@corates/ui' package instead of local components directories
Use solid-icons library for icons instead of emojis or other icon sources
Use Tailwind CSS classes for styling UI components
Apply responsive design using mobile-first approach with Tailwind CSS
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Use import aliases from jsconfig.json (e.g., @/, @components/, @auth-ui/, @checklist-ui/, @project-ui/, @routes/, @primitives/, @api/, @config/, @lib/) instead of relative paths
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/yjs-sync.mdc)
**/*.{js,jsx,ts,tsx}: Use theuseProjecthook for managing Yjs connections with reference counting instead of creating Y.Doc instances directly
Never create Y.Doc instances directly; always use the connection registry managed by useProject
Access Y.Doc connection state via projectStore.getConnectionState(projectId) instead of checking connection state directly
Read Yjs-synced data from projectStore (using getStudies, getChecklist, etc.) rather than accessing Y.Doc maps/arrays directly
Use operation functions from useProject or projectActionsStore for writing data instead of directly modifying Y.Doc
Don't store Y.Doc references in component state; always retrieve the connection through useProject
Handle connection cleanup via onCleanup() in Solid.js components or equivalent cleanup patterns, calling disconnect() when the component unmounts
**/*.{js,jsx,ts,tsx}: For UI icons, usesolid-iconslibrary or SVGs only (never emojis)
Prefer modern ES6+ syntax and features
Use import aliases from jsconfig.json (see ui-components.mdc)
Group related components in subdirectories with barrel exports
Use Ark UI components from@corates/uipackage, NOT local components
Usesolid-iconsicon library (e.g.,solid-icons/bi,solid-icons/fi) for icons
Comments should explain WHY something is being done, not narrate what the code does
Use comments to explain why a particular approach or workaround was chosen
Use comments to clarify intent when code could be misread or misunderstood
Use comments to provide context from external systems, specs, or requirements
Use comments to document assumptions, edge cases, or limitations
Do NOT narrate what the code is doing in comments
Do NOT duplicate function or variable names in plain English in comments
Do NOT leave stale comments that contradict the code
Do NOT reference removed or obsolete code paths in comments
**/*.{js,jsx,ts,tsx}: Prefer modern ES6+ syntax and features
Comments should not repeat what the code is saying. Rese...
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
**/*.{js,jsx,ts,tsx,css,scss}
📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)
Ensure browser compatibility (Safari is usually problematic)
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)
packages/web/**/*.{jsx,tsx}: Do NOT prop-drill application state in SolidJS - import stores directly where needed
Do NOT destructure props in SolidJS - accessprops.fielddirectly or wrap in function:() => props.field
Shared state lives in external stores underpackages/web/src/stores/
SolidJS components should receive at most 1-5 props (local config only, not shared state)
UsecreateStorefor complex state objects in SolidJS
UsecreateMemofor derived values in SolidJS
Move business logic to stores, utilities, or primitives - not components
Frontend uses orgSlug in URLs (/orgs/:orgSlug/...) for readabilityUse
createFormErrorSignalsfor form error handling in frontend forms to manage field-level and global error states
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
packages/web/src/**
📄 CodeRabbit inference engine (.cursor/rules/organizations.mdc)
packages/web/src/**: Use human-readable slug in frontend URLs: /orgs/:orgSlug/...
Use orgId (UUID) for API calls, not orgSlug, when making fetch requests to backend endpoints
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/{web,ui}/src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Group related components in subdirectories with barrel exports
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/{workers,web}/src/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Better-Auth for authentication and user management
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/{web,landing,docs}/src/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/{web,landing,docs}/src/**/*.{jsx,tsx}: Use Ark UI components from@corates/uipackage, NOT local components
Usesolid-iconsfor icon imports (e.g.,solid-icons/bi,solid-icons/fi)
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
packages/web/src/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/web/src/**/*.{js,ts,jsx,tsx}: UsecreateStorefor complex state objects
UsecreateMemofor derived values
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
packages/web/**/*.{js,ts,jsx,tsx}: UseapiFetchfor all frontend API calls instead of raw fetch to automatically handle JSON parsing, errors, and toast notifications
UsehandleFetchErrorfor wrapping legacy raw fetch calls in frontend code (legacy pattern, prefer apiFetch)
Use error utility functions likeisErrorCodefrom error-utils to check specific error types instead of direct string comparisons
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/{web,workers}/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
Never throw string literals; always throw Error objects or return domain errors from API routes
Files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
packages/web/src/stores/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Shared state lives in external stores under
packages/web/src/stores/
Files:
packages/web/src/stores/localChecklistsStore.js
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/lib/checklist-domain.js,packages/web/src/AMSTAR2/checklist-compare.js} : Store final answers in the reconciled checklist itself, not in reconciliation progress metadata
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/primitives/useProject/checklists.js : Store question notes as Y.Text objects obtained from useProject hook via getQuestionNote operation to enable collaborative editing
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js,packages/web/src/primitives/useProject/checklists.js : Use checklist operations from useProject hook (createChecklist, updateChecklistAnswer, getChecklistData) instead of manually updating checklist structure
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js : Use getChecklistStatus utility from @/lib/checklist-domain.js to determine current checklist status before performing operations
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/AMSTAR2/checklist-compare.js} : Use compareChecklists utility from checklist-compare.js for comparing reviewer checklists
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/lib/checklist-domain.js} : Store reconciliation progress metadata (IDs and optional currentPage) in the study's Y.Map reconciliation property
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js : Checklist status transitions follow sequence: in_progress → completed (when all questions answered) → reconciled (after reconciliation complete)
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/lib/checklist-domain.js,packages/web/src/AMSTAR2/checklist-compare.js} : Reconciliation structure should contain checklist1Id, checklist2Id, and reconciledChecklistId
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to packages/web/src/components/checklist-ui/compare/** : Use Y.Text objects for collaborative editing of question notes in reconciliation
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js : Maintain separate answer format implementations for each checklist type (AMSTAR2, ROBINS-I, Generic) to prevent data corruption
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Use external stores in packages/web/src/stores/ for shared/cross-feature state instead of prop-drilling
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/lib/checklist-domain.js : Register and retrieve checklists using checklist-registry: getChecklistType and getChecklistComponent functions
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx} : Use local createSignal or createStore for local component state; use external stores for shared/cross-feature state
📚 Learning: 2025-12-27T03:01:06.933Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js,packages/web/src/primitives/useProject/checklists.js : Use checklist operations from useProject hook (createChecklist, updateChecklistAnswer, getChecklistData) instead of manually updating checklist structure
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:01:06.933Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/AMSTAR2/**,packages/web/src/ROBINS-I/**,packages/web/src/lib/checklist-domain.js : Use getChecklistStatus utility from @/lib/checklist-domain.js to determine current checklist status before performing operations
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:14.854Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/AMSTAR2/checklist-compare.js} : Use compareChecklists utility from checklist-compare.js for comparing reviewer checklists
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:01:06.933Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/primitives/useProject/checklists.js : Store question notes as Y.Text objects obtained from useProject hook via getQuestionNote operation to enable collaborative editing
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:14.854Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/lib/checklist-domain.js,packages/web/src/AMSTAR2/checklist-compare.js} : Store final answers in the reconciled checklist itself, not in reconciliation progress metadata
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:05.951Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/pdf-handling.mdc:0-0
Timestamp: 2025-12-27T03:02:05.951Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx} : Use `PdfViewer` component from `@/components/checklist-ui/pdf/PdfViewer.jsx` for displaying PDFs, passing pdfData as ArrayBuffer, fileName, readOnly, and onPageChange
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:02:14.854Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to packages/web/src/components/checklist-ui/compare/** : Use Y.Text objects for collaborative editing of question notes in reconciliation
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsx
📚 Learning: 2025-12-27T03:01:06.933Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/checklist-operations.mdc:0-0
Timestamp: 2025-12-27T03:01:06.933Z
Learning: Applies to packages/web/src/components/checklist-ui/**,packages/web/src/lib/checklist-domain.js : Register and retrieve checklists using checklist-registry: getChecklistType and getChecklistComponent functions
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:05.951Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/pdf-handling.mdc:0-0
Timestamp: 2025-12-27T03:02:05.951Z
Learning: Applies to packages/web/src/**/*.{js,jsx,ts,tsx} : Use `pdfPreviewStore` from `@/stores/pdfPreviewStore.js` for managing PDF preview state (openPreview, closePreview, getPreview methods)
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:05.951Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/pdf-handling.mdc:0-0
Timestamp: 2025-12-27T03:02:05.951Z
Learning: Applies to packages/web/src/**/*.{js,jsx,ts,tsx} : Use PDF operations from `useProject` hook instead of bypassing through direct API calls
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx} : Use local createSignal or createStore for local component state; use external stores for shared/cross-feature state
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Keep SolidJS components lean and focused on rendering - move business logic to stores, primitives, or utilities
Applied to files:
packages/web/src/components/checklist/LocalChecklistView.jsxpackages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Use external stores in packages/web/src/stores/ for shared/cross-feature state instead of prop-drilling
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2026-01-01T23:32:06.095Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/corates.mdc:0-0
Timestamp: 2026-01-01T23:32:06.095Z
Learning: Applies to packages/web/**/*.{jsx,tsx} : Shared state lives in external stores under `packages/web/src/stores/`
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2026-01-06T18:29:08.736Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-01-06T18:29:08.736Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx} : Move business logic to stores, utilities, or primitives (not components)
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Create reusable logic in primitives (hooks) in packages/web/src/primitives/ and import them into components
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx} : Use createStore for complex objects and arrays that need granular reactivity in SolidJS
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2026-01-01T23:32:06.095Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/corates.mdc:0-0
Timestamp: 2026-01-01T23:32:06.095Z
Learning: Applies to packages/web/**/*.{jsx,tsx} : Use `createStore` for complex state objects in SolidJS
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/components/checklist/LocalAppraisalsPanel.jsxpackages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:02:50.087Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/yjs-sync.mdc:0-0
Timestamp: 2025-12-27T03:02:50.087Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Read Yjs-synced data from projectStore (using getStudies, getChecklist, etc.) rather than accessing Y.Doc maps/arrays directly
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsxpackages/web/src/stores/localChecklistsStore.js
📚 Learning: 2026-01-06T18:29:08.736Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-01-06T18:29:08.736Z
Learning: Applies to packages/{workers,web}/src/**/*.{js,ts,jsx,tsx} : Use Better-Auth for authentication and user management
Applied to files:
packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Use Solid's For component for rendering lists instead of Array.map()
Applied to files:
packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{js,jsx,ts,tsx} : Use createSignal for simple reactive values in SolidJS components
Applied to files:
packages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:02:26.947Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/solidjs.mdc:0-0
Timestamp: 2025-12-27T03:02:26.947Z
Learning: Applies to {packages/web/**,packages/landing/**}/**/*.{jsx,tsx} : Use Solid's Show component for conditional rendering instead of ternary operators
Applied to files:
packages/web/src/components/checklist/CreateLocalChecklist.jsx
📚 Learning: 2025-12-27T03:02:50.087Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/yjs-sync.mdc:0-0
Timestamp: 2025-12-27T03:02:50.087Z
Learning: Applies to packages/web/src/primitives/useProject/**, packages/web/src/stores/projectStore.js : Local projects (with IDs starting with 'local-') use IndexedDB persistence only and skip WebSocket connection, but still use Y.Doc structure and sync to store normally
Applied to files:
packages/web/src/stores/localChecklistsStore.js
📚 Learning: 2026-01-06T18:29:08.736Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-01-06T18:29:08.736Z
Learning: Applies to packages/web/src/stores/**/*.{js,ts,jsx,tsx} : Shared state lives in external stores under `packages/web/src/stores/`
Applied to files:
packages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:14.854Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/reconciliation.mdc:0-0
Timestamp: 2025-12-27T03:02:14.854Z
Learning: Applies to {packages/web/src/components/checklist-ui/compare/**,packages/web/src/lib/checklist-domain.js} : Store reconciliation progress metadata (IDs and optional currentPage) in the study's Y.Map reconciliation property
Applied to files:
packages/web/src/stores/localChecklistsStore.js
📚 Learning: 2025-12-27T03:02:50.087Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/yjs-sync.mdc:0-0
Timestamp: 2025-12-27T03:02:50.087Z
Learning: Applies to packages/web/src/primitives/useProject/**, packages/web/src/stores/projectStore.js : IndexedDB persistence is set up automatically by useProject with database name 'corates-project-${projectId}'; don't manually create IndexedDB providers
Applied to files:
packages/web/src/stores/localChecklistsStore.js
🧬 Code graph analysis (5)
packages/web/src/components/checklist/LocalChecklistView.jsx (1)
packages/web/src/components/checklist/CreateLocalChecklist.jsx (1)
localChecklistsStore(18-18)
packages/web/src/components/sidebar/Sidebar.jsx (3)
packages/web/src/components/checklist/CreateLocalChecklist.jsx (1)
localChecklistsStore(18-18)packages/web/src/components/checklist/LocalAppraisalsPanel.jsx (1)
localChecklistsStore(24-24)packages/web/src/components/checklist/LocalChecklistView.jsx (1)
localChecklistsStore(22-22)
packages/web/src/components/checklist/LocalAppraisalsPanel.jsx (3)
packages/web/src/components/checklist/CreateLocalChecklist.jsx (1)
localChecklistsStore(18-18)packages/web/src/components/checklist/LocalChecklistView.jsx (1)
localChecklistsStore(22-22)packages/web/src/components/sidebar/Sidebar.jsx (1)
localChecklistsStore(32-32)
packages/web/src/components/checklist/CreateLocalChecklist.jsx (3)
packages/web/src/components/checklist/LocalAppraisalsPanel.jsx (1)
localChecklistsStore(24-24)packages/web/src/components/checklist/LocalChecklistView.jsx (1)
localChecklistsStore(22-22)packages/web/src/components/sidebar/Sidebar.jsx (1)
localChecklistsStore(32-32)
packages/web/src/stores/localChecklistsStore.js (1)
packages/web/src/checklist-registry/index.js (1)
createChecklistOfType(68-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Workers Builds: corates
🔇 Additional comments (7)
packages/web/src/components/checklist/LocalChecklistView.jsx (1)
14-14: Store migration looks correct.The import and destructuring pattern is appropriate here. Since
getChecklist,updateChecklist,getPdf,savePdf, anddeletePdfare stable async function references (not reactive signals), destructuring them at component initialization is safe and won't break reactivity.Also applies to: 22-22
packages/web/src/components/checklist/LocalAppraisalsPanel.jsx (1)
12-12: Store consumption pattern is correct.Destructuring signal accessors (
checklists,loading) and async methods (deleteChecklist,updateChecklist) from the store is safe here. The signal accessors are called correctly aschecklists()andloading()throughout the component, preserving reactivity.Also applies to: 24-24
packages/web/src/components/checklist/CreateLocalChecklist.jsx (1)
9-9: Store method consumption is appropriate.Destructuring
createChecklistandsavePdfis safe since they are stable async function references. The usage at lines 58 and 63 correctly awaits these operations.Also applies to: 18-18
packages/web/src/components/sidebar/Sidebar.jsx (1)
5-5: Store migration maintains reactivity correctly.The destructured
checklistssignal accessor is correctly invoked aschecklists()at all usage sites (lines 131, 352, 368, 597, 613). ThedeleteChecklistasync function is correctly awaited at line 149.Also applies to: 32-32
packages/web/src/stores/localChecklistsStore.js (3)
1-12: Well-structured store with clear separation of concerns.The store correctly uses
createSignalfor reactive state and exposes both signal accessors and async methods. The IndexedDB versioning and store setup look appropriate.
157-173: Delete operations don't check for individual failures before transaction completes.If
checklistStore.delete()orpdfStore.delete()encounters an error for a non-existent key, it won't throw (deleting a non-existent key is a no-op in IndexedDB). However, if there's a different error,transaction.onerrorwill catch it. The current implementation is correct for the expected use case.
209-227: Module-level initialization is appropriate for this shared store pattern.Calling
init()at module load ensures the database and initial data are ready when any component imports the store. This aligns with the project's store conventions. The named exportlocalChecklistsStoreprovides a convenient alias for destructuring while maintaining the default export.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.