Skip to content

refactored localchecklist primitive into a store#241

Merged
InfinityBowman merged 1 commit into
mainfrom
240-sidebar-reactivity-issue
Jan 7, 2026
Merged

refactored localchecklist primitive into a store#241
InfinityBowman merged 1 commit into
mainfrom
240-sidebar-reactivity-issue

Conversation

@InfinityBowman
Copy link
Copy Markdown
Owner

@InfinityBowman InfinityBowman commented Jan 7, 2026

Summary by CodeRabbit

  • Refactor
    • Reorganized internal architecture for local checklist management by transitioning from a hook-based pattern to a store-based approach. All existing functionality—checklist creation, updates, deletion, and PDF management—remains unchanged and operates identically. No impact to end-users.

✏️ Tip: You can customize this high-level summary in your review settings.

@InfinityBowman InfinityBowman linked an issue Jan 7, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

This PR migrates local checklist state management from a custom hook (useLocalChecklists) to a centralized store pattern (localChecklistsStore). The hook is removed, a new store file is introduced, and four component files are updated to consume the store instead. The underlying IndexedDB functionality and public API surface remain preserved.

Changes

Cohort / File(s) Summary
Hook Removal
packages/web/src/primitives/useLocalChecklists.js
Entire IndexedDB-backed hook module removed, including CRUD operations (createChecklist, updateChecklist, deleteChecklist), PDF management (savePdf, getPdf, deletePdf), reactive state (checklists, loading, error), and database initialization logic.
New Store Implementation
packages/web/src/stores/localChecklistsStore.js
New centralized store introduced with reactive signals (checklists, loading, error) and methods for local checklist and PDF management (createChecklist, getChecklist, updateChecklist, deleteChecklist, savePdf, getPdf, deletePdf, refetch). Handles IndexedDB initialization, persistence, and state synchronization. Exports both default and named exports.
Component Store Migration
packages/web/src/components/checklist/CreateLocalChecklist.jsx, LocalAppraisalsPanel.jsx, LocalChecklistView.jsx; packages/web/src/components/sidebar/Sidebar.jsx
Four components refactored to import and use localChecklistsStore from the new store location instead of useLocalChecklists hook. Import paths changed from @primitives/useLocalChecklists.js to @/stores/localChecklistsStore. Destructured properties and method signatures remain functionally equivalent.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • 76 minor adjustments to studies and checklists #77: Updates components to use functions from useLocalChecklists (e.g., updateChecklist), while this PR replaces that hook with a new store providing equivalent methods—merge conflicts or integration needed.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: converting a hook-based primitive (useLocalChecklists) into a store-based implementation (localChecklistsStore), which is reflected across all modified component files.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
corates ca5f112 Commit Preview URL Jan 07 2026, 04:10 AM

@InfinityBowman InfinityBowman merged commit 9e40d34 into main Jan 7, 2026
2 of 3 checks passed
@InfinityBowman InfinityBowman deleted the 240-sidebar-reactivity-issue branch January 7, 2026 04:12
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/web/src/stores/localChecklistsStore.js (2)

17-49: Consider adding onblocked handler 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 template and then explicitly re-assign id, name, and checklistType which are already set in template (per createChecklistOfType at line 96-101 and the registry snippet). While this works as an intentional override, createdAt is 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

📥 Commits

Reviewing files that changed from the base of the PR and between ac06b35 and ca5f112.

📒 Files selected for processing (6)
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/primitives/useLocalChecklists.js
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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 use uploadPdf from @api/pdf-api.js for 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)
Use cachePdf and getCachedPdf from @primitives/pdfCache.js for 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
Use importFromGoogleDrive from @api/google-drive.js for importing PDFs from Google Drive. Pass fileId, projectId, studyId, and tag
Save form state using saveFormState from @/lib/formStatePersistence.js before triggering OAuth redirects for Google Drive
Use addPdfToStudy operation from useProject hook to add PDFs to a study, passing id, name, size, tag, uploadedAt, and uploadedBy
Use removePdfFromStudy operation from useProject hook to remove PDFs from a study
Use pdfPreviewStore from @/stores/pdfPreviewStore.js for managing PDF preview state (openPreview, closePreview, getPreview methods)
Use downloadPdf from @api/pdf-api.js to download PDFs from server, then cache the result using cachePdf
Always cache PDFs after download and check cache before downloading to avoid redundant downloads
Use PDF operations from useProject hook instead of bypassing through direct API calls

packages/web/src/**/*.{js,jsx,ts,tsx}: For UI icons, use solid-icons library or SVGs only (never emojis)
Use import aliases from jsconfig.json (see ui-components.mdc)

Files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/web/src/stores/localChecklistsStore.js
packages/web/src/**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/pdf-handling.mdc)

Use PdfViewer component from @/components/checklist-ui/pdf/PdfViewer.jsx for 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 - Access props.field directly 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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/web/src/stores/localChecklistsStore.js
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/yjs-sync.mdc)

**/*.{js,jsx,ts,tsx}: Use the useProject hook 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, use solid-icons library 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/ui package, NOT local components
Use solid-icons icon 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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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 - access props.field directly or wrap in function: () => props.field
Shared state lives in external stores under packages/web/src/stores/
SolidJS components should receive at most 1-5 props (local config only, not shared state)
Use createStore for complex state objects in SolidJS
Use createMemo for derived values in SolidJS
Move business logic to stores, utilities, or primitives - not components
Frontend uses orgSlug in URLs (/orgs/:orgSlug/...) for readability

Use createFormErrorSignals for form error handling in frontend forms to manage field-level and global error states

Files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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/ui package, NOT local components
Use solid-icons for icon imports (e.g., solid-icons/bi, solid-icons/fi)

Files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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}: Use createStore for complex state objects
Use createMemo for derived values

Files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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}: Use apiFetch for all frontend API calls instead of raw fetch to automatically handle JSON parsing, errors, and toast notifications
Use handleFetchError for wrapping legacy raw fetch calls in frontend code (legacy pattern, prefer apiFetch)
Use error utility functions like isErrorCode from error-utils to check specific error types instead of direct string comparisons

Files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • 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/AMSTAR2/checklist-compare.js} : Use compareChecklists utility from checklist-compare.js for comparing reviewer checklists

Applied to files:

  • packages/web/src/components/checklist/LocalChecklistView.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • 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,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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/web/src/components/checklist/CreateLocalChecklist.jsx
  • packages/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.jsx
  • 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 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.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • 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/**}/**/*.{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.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • packages/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.jsx
  • packages/web/src/components/checklist/LocalAppraisalsPanel.jsx
  • 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 **/*.{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.jsx
  • 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/{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, and deletePdf are 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 as checklists() and loading() 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 createChecklist and savePdf is 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 checklists signal accessor is correctly invoked as checklists() at all usage sites (lines 131, 352, 368, 597, 613). The deleteChecklist async 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 createSignal for 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() or pdfStore.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.onerror will 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 export localChecklistsStore provides a convenient alias for destructuring while maintaining the default export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar reactivity issue

1 participant