104 refactor project state handlers#105
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
corates | a0a570a | Commit Preview URL | Dec 19 2025, 01:59 PM |
|
Caution Review failedThe pull request is closed. WalkthroughCentralizes project mutation logic into a new singleton Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Component (e.g., Tab / StudyCard)
participant Store as projectActionsStore
participant Conn as ActiveConnection (ops)
participant API as Server/API
participant Cache as pdfCache / projectStore
participant UI2 as Toast/Preview UI
UI->>Store: call e.g., pdf.upload(studyId, file, tag)
Store->>Conn: getActiveConnection() → ops.uploadPdf(...)
Conn->>API: upload request
API-->>Conn: upload response (pdfId, metadata)
Conn-->>Store: return uploaded metadata
Store->>Cache: cache buffer, update projectStore/study
Store->>UI2: showToast("Uploaded") / update preview
UI2-->>UI: UI updates (progress/confirmation)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (8)
eslint.config.js (1)
110-110: Reconsider suppressing cognitive-complexity checks.The
cognitive-complexityrule helps maintain code readability and testability. Since this PR involves a major refactoring to a store-based architecture, consider addressing any complexity issues in the refactored code rather than disabling the check. If specific functions exceed complexity thresholds, break them into smaller, focused units.Based on learnings, keep files small, focused, and modular by extracting complex logic into separate utility files.
packages/web/src/stores/projectActionsStore/reconciliation.js (1)
14-33: Silent failures may hide reconciliation errors from users.Unlike
checklists.jswhich shows toast notifications on failures, these methods silently returnundefinedwhen the connection is unavailable or methods are missing. For user-facing operations like saving reconciliation progress, consider adding error feedback for consistency.Example: Adding error handling to saveProgress
function saveProgress(studyId, checklist1Id, checklist2Id, data) { const ops = getActiveConnection(); + if (!ops?.saveReconciliationProgress) { + console.warn('Cannot save reconciliation progress: not connected'); + return undefined; + } return ops?.saveReconciliationProgress?.(studyId, checklist1Id, checklist2Id, data); }packages/web/src/stores/projectActionsStore/checklists.js (1)
86-89: Consider adding error handling toupdateAnswer.This is a mutation operation that modifies state, but unlike
create/update/delete, it lacks error handling and user feedback. If the connection is unavailable, the user won't know their answer wasn't saved.packages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsx (2)
77-80: Consider awaiting the async Google Drive import.
projectActionsStore.pdf.handleGoogleDriveImportlikely performs async operations (API calls, file processing). If errors occur, they won't be caught here. Consider making this handler async and adding error handling.Proposed improvement
- const handleGoogleDriveImportSuccess = file => { + const handleGoogleDriveImportSuccess = async file => { const studyId = googleDriveTargetStudyId(); - projectActionsStore.pdf.handleGoogleDriveImport(studyId, file); + try { + await projectActionsStore.pdf.handleGoogleDriveImport(studyId, file); + } catch (err) { + console.error('Google Drive import failed:', err); + } };
153-162: StudyCard prop count is at the threshold.The component receives 6 props, which is slightly over the coding guideline of 1-5 props. Given that
studyis the data payload and the others are UI controls, this is acceptable for now. Consider consolidating callbacks into a singlehandlersobject or moving expand state into a store if this grows further. Based on coding guidelines.packages/web/src/stores/projectActionsStore/project.js (1)
19-31: Inconsistent error handling pattern across operations.
renamesilently returns on failure (after showing a toast), whiledeleteByIdthrows the error. This inconsistency can confuse callers. Consider making all operations either throw or return a result object for consistency.Proposed pattern for consistency
async function rename(newName) { const ops = getActiveConnection(); if (!ops?.renameProject) { showToast.error('Rename Failed', 'Not connected to project'); - return; + throw new Error('Not connected to project'); } try { await ops.renameProject(newName); } catch (err) { console.error('Error renaming project:', err); showToast.error('Rename Failed', err.message || 'Failed to rename project'); + throw err; } }packages/web/src/stores/projectActionsStore/studies.js (1)
308-324: Minor: abstract passed as both description and metadata.The
study.abstractis used for both thedescriptionparameter and withinmetadata.abstract. This is likely intentional for different use cases but creates data duplication. Consider if the description parameter is needed.packages/web/src/stores/projectActionsStore/index.js (1)
112-132: Note thegetActiveProjectIdaliasing for clarity.Line 132 aliases the public
getActiveProjectIdtogetActiveProjectIdOrNull, which returns null when no active project is set. Internally, there's also agetActiveProjectId()function that throws instead. While this works correctly (the throwing version isn't exported), future maintainers should be aware that the public API returns null rather than throwing.Consider adding a JSDoc comment to the public API to clarify this behavior.
Optional: Add JSDoc to clarify behavior
return { // Internal - called by useProject hook and ProjectView _setConnection, _removeConnection, _getConnection, _setActiveProject, _clearActiveProject, - // Utility + /** + * Get active project ID or null if not set + * @returns {string|null} + */ getActiveProjectId: getActiveProjectIdOrNull,
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
eslint.config.js(3 hunks)packages/web/src/components/project-ui/ProjectContext.jsx(1 hunks)packages/web/src/components/project-ui/ProjectDashboard.jsx(2 hunks)packages/web/src/components/project-ui/ProjectView.jsx(6 hunks)packages/web/src/components/project-ui/StudyCard.jsx(0 hunks)packages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsx(7 hunks)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx(2 hunks)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsx(3 hunks)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsx(3 hunks)packages/web/src/components/project-ui/completed-tab/CompletedTab.jsx(3 hunks)packages/web/src/components/project-ui/overview-tab/OverviewTab.jsx(6 hunks)packages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsx(1 hunks)packages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsx(3 hunks)packages/web/src/components/project-ui/todo-tab/ToDoTab.jsx(3 hunks)packages/web/src/primitives/useProject/index.js(3 hunks)packages/web/src/primitives/useProjectChecklistHandlers.js(0 hunks)packages/web/src/primitives/useProjectMemberHandlers.js(0 hunks)packages/web/src/primitives/useProjectPdfHandlers.js(0 hunks)packages/web/src/primitives/useProjectStudyHandlers.js(0 hunks)packages/web/src/stores/projectActionsStore/checklists.js(1 hunks)packages/web/src/stores/projectActionsStore/index.js(1 hunks)packages/web/src/stores/projectActionsStore/members.js(1 hunks)packages/web/src/stores/projectActionsStore/pdfs.js(1 hunks)packages/web/src/stores/projectActionsStore/project.js(1 hunks)packages/web/src/stores/projectActionsStore/reconciliation.js(1 hunks)packages/web/src/stores/projectActionsStore/studies.js(1 hunks)
💤 Files with no reviewable changes (5)
- packages/web/src/components/project-ui/StudyCard.jsx
- packages/web/src/primitives/useProjectMemberHandlers.js
- packages/web/src/primitives/useProjectStudyHandlers.js
- packages/web/src/primitives/useProjectChecklistHandlers.js
- packages/web/src/primitives/useProjectPdfHandlers.js
🧰 Additional context used
📓 Path-based instructions (13)
**/*
📄 CodeRabbit inference engine (.cursorrules)
Do not use emojis in code, comments, documentation, or commit messages
Files:
eslint.config.jspackages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
**/*.{js,jsx,ts,tsx,json,md,css,html}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Do not use emojis in code, comments, documentation, or commit messages
Files:
eslint.config.jspackages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{js,jsx,ts,tsx}: Follow standard JavaScript/SolidJS/Cloudflare best practices
Prefer modern ES6+ syntax and features
Use aliases for imports when appropriate to improve readability
Prefer using config files rather than hardcoding values
Keep files small, focused, and modular. Extract sub-modules into a folder with index.jsx and helper components, move complex logic into separate utility files or primitives, and split large forms into section components
Each file should handle one coherent responsibility
Files:
eslint.config.jspackages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/**/*.{jsx,tsx,js,ts}
📄 CodeRabbit inference engine (.cursorrules)
packages/web/src/**/*.{jsx,tsx,js,ts}: For UI icons, use thesolid-iconslibrary or SVGs only. Do not use emojis
Import stores directly where needed instead of passing values through multiple components
When you need to compute a value based on props or state in SolidJS, usecreateMemoto ensure it updates reactively
For complex state or state objects in SolidJS, use Solid'screateStorefor better performance and reactivity
You may create reusable logic in 'primitives' (hooks) that can be shared across components to keep components clean and focused on rendering
Files:
packages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
packages/**/*.{js,jsx,ts,tsx}: Prefer modern ES6+ syntax and features
Use aliases for imports when appropriate to improve readability
Prefer using config files rather than hardcoding values
Keep files small, focused, and modular. If a file exceeds a high number of lines, consider refactoring by extracting sub-modules into a folder with index.jsx and helper components, moving complex logic into separate utility files or primitives, or splitting large forms into section components
Each file should handle one coherent responsibility
Use Zod for schema and input validation
Files:
packages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/**/*.{jsx,tsx,js,ts,css}
📄 CodeRabbit inference engine (.cursorrules)
Ensure browser compatibility for all frontend code (Safari is usually problematic)
Files:
packages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/web/src/**/*.{js,jsx,ts,tsx}: For UI icons, use thesolid-iconslibrary or SVGs only. Do not use emojis
Ensure browser compatibility for all frontend code (Safari is usually problematic)
Do NOT prop-drill application state. Shared or cross-feature state must live in external stores under packages/web/src/stores/ or relative to the component file
UsecreateMemoto compute values based on props or state to ensure reactive updates
Create reusable logic in primitives (hooks) that can be shared across components to keep components clean and focused on rendering
Files:
packages/web/src/stores/projectActionsStore/project.jspackages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/stores/projectActionsStore/members.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/primitives/useProject/index.jspackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/stores/**/*.{js,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Solid's
createStorefor complex state or state objects to ensure better performance and reactivity
Files:
packages/web/src/stores/projectActionsStore/project.jspackages/web/src/stores/projectActionsStore/reconciliation.jspackages/web/src/stores/projectActionsStore/members.jspackages/web/src/stores/projectActionsStore/checklists.jspackages/web/src/stores/projectActionsStore/pdfs.jspackages/web/src/stores/projectActionsStore/studies.jspackages/web/src/stores/projectActionsStore/index.js
packages/web/src/components/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursorrules)
packages/web/src/components/**/*.{jsx,tsx}: Use responsive design principles for UI components
Use Zag.js for UI components and design system
Zag components exist inpackages/web/src/components/zag/*and should be reused; check the README.md in that folder for a list of existing components before adding new components and when debugging
Components should receive at most 1–5 props, and only for local configuration, not shared state
If a component would need more than 5 props, move the shared data into an external store, a primitive, or Solid context
Components should be lean and focused and should not implement business logic; move business logic into stores, utilities, or primitives
Never have a component act as a 'God component' coordinating multiple large concerns
Files:
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/components/**/*.{jsx,tsx,js}
📄 CodeRabbit inference engine (.cursorrules)
Group related components in subdirectories with an
index.jsbarrel export
Files:
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursorrules)
packages/web/src/**/*.{jsx,tsx}: Do NOT prop-drill application state. Shared or cross-feature state must live in external stores under packages/web/src/stores/ or relative to the component file
Do not destructure props in SolidJS components as it breaks reactivity. Instead, access props directly from the props object or wrap them in a function to ensure they are always up-to-date
Files:
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/components/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/web/src/components/**/*.{js,jsx,ts,tsx}: Use responsive design principles for UI components
Use Zag.js for UI components and design system
Reuse Zag components frompackages/web/src/components/zag/*and check the README.md in that folder for existing components before adding new components
Components should receive at most 1–5 props, and only for local configuration, not shared state. If a component would need more than 5 props, move the shared data into an external store, a primitive, or Solid context
Do not destructure props in SolidJS components. Instead, access props directly from the props object or wrap them in a function to ensure they are always up-to-date
Components should be lean and focused on rendering. Do not implement business logic; move that into stores, utilities, or primitives
Never have a component act as a 'God component' coordinating multiple large concerns
Files:
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
packages/web/src/components/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Group related components in subdirectories with an
index.jsbarrel export
Files:
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsxpackages/web/src/components/project-ui/ProjectContext.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsxpackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsxpackages/web/src/components/project-ui/overview-tab/OverviewTab.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsxpackages/web/src/components/project-ui/ProjectDashboard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/components/project-ui/ProjectView.jsxpackages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
🧠 Learnings (21)
📓 Common learnings
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/components/**/*.{jsx,tsx} : If a component would need more than 5 props, move the shared data into an external store, a primitive, or Solid context
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx,js,ts} : Import stores directly where needed instead of passing values through multiple components
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx,js,ts} : For complex state or state objects in SolidJS, use Solid's `createStore` for better performance and reactivity
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Prefer using config files rather than hardcoding values
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/**/*.{js,jsx,ts,tsx} : Prefer using config files rather than hardcoding values
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Follow standard JavaScript/SolidJS/Cloudflare best practices
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Prefer modern ES6+ syntax and features
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/**/*.{js,jsx,ts,tsx} : Prefer modern ES6+ syntax and features
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Each file should handle one coherent responsibility
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Keep files small, focused, and modular. Extract sub-modules into a folder with index.jsx and helper components, move complex logic into separate utility files or primitives, and split large forms into section components
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:38.879Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.879Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Use aliases for imports when appropriate to improve readability
Applied to files:
eslint.config.jspackages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/**/*.{js,jsx,ts,tsx} : Each file should handle one coherent responsibility
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/**/*.{js,jsx,ts,tsx} : Use Zod for schema and input validation
Applied to files:
eslint.config.js
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/**/*.{js,jsx,ts,tsx} : Use aliases for imports when appropriate to improve readability
Applied to files:
packages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx,js,ts} : Import stores directly where needed instead of passing values through multiple components
Applied to files:
packages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsxpackages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsxpackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/components/**/*.{jsx,tsx} : Zag components exist in `packages/web/src/components/zag/*` and should be reused; check the README.md in that folder for a list of existing components before adding new components and when debugging
Applied to files:
packages/web/src/components/project-ui/reconcile-tab/ReconcileStudyCard.jsx
📚 Learning: 2025-12-19T12:38:38.880Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.880Z
Learning: Applies to packages/web/src/stores/**/*.{js,ts} : Use Solid's `createStore` for complex state or state objects to ensure better performance and reactivity
Applied to files:
packages/web/src/primitives/useProject/index.jspackages/web/src/stores/projectActionsStore/index.jspackages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx,js,ts} : For complex state or state objects in SolidJS, use Solid's `createStore` for better performance and reactivity
Applied to files:
packages/web/src/components/project-ui/todo-tab/ToDoTab.jsxpackages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:38.880Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-19T12:38:38.880Z
Learning: Applies to packages/web/src/**/*.{js,jsx,ts,tsx} : Create reusable logic in primitives (hooks) that can be shared across components to keep components clean and focused on rendering
Applied to files:
packages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx,js,ts} : You may create reusable logic in 'primitives' (hooks) that can be shared across components to keep components clean and focused on rendering
Applied to files:
packages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/components/**/*.{jsx,tsx} : Use Zag.js for UI components and design system
Applied to files:
packages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/components/**/*.{jsx,tsx} : If a component would need more than 5 props, move the shared data into an external store, a primitive, or Solid context
Applied to files:
packages/web/src/components/project-ui/ProjectView.jsx
📚 Learning: 2025-12-19T12:38:18.491Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursorrules:0-0
Timestamp: 2025-12-19T12:38:18.491Z
Learning: Applies to packages/web/src/**/*.{jsx,tsx} : Do not destructure props in SolidJS components as it breaks reactivity. Instead, access props directly from the props object or wrap them in a function to ensure they are always up-to-date
Applied to files:
packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx
🧬 Code graph analysis (9)
packages/web/src/components/project-ui/completed-tab/CompletedTab.jsx (8)
packages/web/src/components/project-ui/ProjectContext.jsx (1)
useProjectContext(53-59)packages/web/src/components/project-ui/ProjectView.jsx (1)
navigate(33-33)packages/web/src/components/project-ui/ProjectDashboard.jsx (1)
navigate(13-13)packages/web/src/components/checklist-ui/ChecklistYjsWrapper.jsx (1)
navigate(16-16)packages/web/src/components/checklist-ui/compare/ReconciliationWrapper.jsx (1)
navigate(16-16)packages/web/src/stores/projectActionsStore/index.js (3)
projectActionsStore(145-145)study(112-112)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx (1)
study(25-25)packages/web/src/components/project-ui/todo-tab/TodoStudyRow.jsx (1)
study(29-29)
packages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsx (14)
packages/web/src/components/project-ui/overview-tab/OverviewTab.jsx (2)
useProjectContext(21-21)navigate(23-23)packages/web/src/components/project-ui/ProjectContext.jsx (1)
useProjectContext(53-59)packages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsx (1)
useProjectContext(25-25)packages/web/src/components/project-ui/completed-tab/CompletedTab.jsx (2)
useProjectContext(14-14)navigate(15-15)packages/web/src/components/project-ui/ProjectHeader.jsx (1)
useProjectContext(7-7)packages/web/src/components/project-ui/ProjectView.jsx (1)
navigate(33-33)packages/web/src/components/project-ui/ProjectDashboard.jsx (1)
navigate(13-13)packages/web/src/components/checklist-ui/ChecklistYjsWrapper.jsx (1)
navigate(16-16)packages/web/src/components/checklist-ui/compare/ReconciliationWrapper.jsx (1)
navigate(16-16)packages/web/src/stores/projectActionsStore/index.js (3)
projectActionsStore(145-145)study(112-112)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx (1)
study(25-25)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsx (1)
study(28-28)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsx (1)
study(22-22)packages/web/src/components/project-ui/todo-tab/TodoStudyRow.jsx (1)
study(29-29)
packages/web/src/stores/projectActionsStore/members.js (2)
packages/web/src/components/project-ui/overview-tab/OverviewTab.jsx (1)
currentUserId(28-28)packages/web/src/components/project-ui/todo-tab/ToDoTab.jsx (1)
currentUserId(28-28)
packages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsx (4)
packages/web/src/stores/projectActionsStore/index.js (3)
projectActionsStore(145-145)study(112-112)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCard.jsx (1)
study(25-25)packages/web/src/components/project-ui/all-studies-tab/study-card/StudyCardHeader.jsx (2)
study(28-28)handleDelete(57-59)packages/web/src/components/project-ui/todo-tab/TodoStudyRow.jsx (1)
study(29-29)
packages/web/src/primitives/useProject/index.js (1)
packages/web/src/stores/projectActionsStore/index.js (1)
projectActionsStore(145-145)
packages/web/src/components/project-ui/ProjectDashboard.jsx (2)
packages/ui/src/zag/Dialog.jsx (1)
useConfirmDialog(243-321)packages/ui/src/zag/Toast.jsx (2)
showToast(121-139)showToast(121-139)
packages/web/src/stores/projectActionsStore/studies.js (5)
packages/web/src/lib/pdfUtils.js (2)
extractPdfTitle(69-71)extractPdfDoi(216-218)packages/web/src/lib/referenceLookup.js (1)
fetchFromDOI(139-170)packages/web/src/api/pdf-api.js (4)
deletePdf(113-127)downloadPdf(79-93)fetchPdfViaProxy(12-30)uploadPdf(40-70)packages/web/src/api/google-drive.js (1)
importFromGoogleDrive(49-73)packages/web/src/primitives/pdfCache.js (1)
cachePdf(111-138)
packages/web/src/components/project-ui/all-studies-tab/AllStudiesTab.jsx (5)
packages/web/src/components/project-ui/ProjectContext.jsx (1)
useProjectContext(53-59)packages/web/src/components/project-ui/reconcile-tab/ReconcileTab.jsx (1)
useProjectContext(15-15)packages/web/src/components/project-ui/todo-tab/ToDoTab.jsx (1)
useProjectContext(15-15)packages/web/src/stores/projectActionsStore/index.js (1)
projectActionsStore(145-145)packages/web/src/stores/projectActionsStore/studies.js (1)
updates(29-29)
packages/web/src/stores/projectActionsStore/index.js (10)
packages/web/src/components/project-ui/ProjectView.jsx (1)
useBetterAuth(35-35)packages/web/src/components/project-ui/ProjectContext.jsx (1)
useBetterAuth(21-21)packages/web/src/components/project-ui/ProjectDashboard.jsx (1)
useBetterAuth(21-21)packages/web/src/components/project-ui/todo-tab/ToDoTab.jsx (1)
useBetterAuth(16-16)packages/web/src/stores/projectActionsStore/studies.js (1)
createStudyActions(204-431)packages/web/src/stores/projectActionsStore/checklists.js (1)
createChecklistActions(12-108)packages/web/src/stores/projectActionsStore/pdfs.js (1)
createPdfActions(17-223)packages/web/src/stores/projectActionsStore/project.js (1)
createProjectActions(15-93)packages/web/src/stores/projectActionsStore/members.js (1)
createMemberActions(14-49)packages/web/src/stores/projectActionsStore/reconciliation.js (1)
createReconciliationActions(10-40)
⏰ 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
| const handleView = pdf => { | ||
| props.onViewPdf?.(study().id, pdf); | ||
| projectActionsStore.pdf.view(study().id, pdf); | ||
| }; | ||
|
|
||
| const handleDownload = pdf => { | ||
| props.onDownloadPdf?.(study().id, pdf); | ||
| projectActionsStore.pdf.download(study().id, pdf); | ||
| }; | ||
|
|
||
| const handleDelete = pdf => { | ||
| props.onDeletePdf?.(study().id, pdf); | ||
| projectActionsStore.pdf.delete(study().id, pdf); | ||
| }; | ||
|
|
||
| const handleTagChange = (pdfId, newTag) => { | ||
| props.onTagChange?.(study().id, pdfId, newTag); | ||
| projectActionsStore.pdf.updateTag(study().id, pdfId, newTag); | ||
| }; | ||
|
|
||
| const handleEditMetadata = pdf => { | ||
| props.onEditPdfMetadata?.(study().id, pdf); | ||
| // TODO: Open metadata edit modal - for now just log | ||
| console.log('Edit metadata for PDF:', pdf.id); | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -name "*projectActionsStore*" -o -name "*pdfs.js" | head -20Repository: InfinityBowman/corates
Length of output: 252
🏁 Script executed:
# Examine the projectActionsStore/pdfs.js implementation
cat -n packages/web/src/stores/projectActionsStore/pdfs.jsRepository: InfinityBowman/corates
Length of output: 8186
🏁 Script executed:
# Examine StudyPdfSection.jsx around the relevant lines
cat -n packages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsx | sed -n '1,100p'Repository: InfinityBowman/corates
Length of output: 3999
🏁 Script executed:
# Find and examine ProjectDashboard.jsx around line 100
find . -name "ProjectDashboard.jsx" -o -name "ProjectDashboard.js" | head -1 | xargs -I {} sh -c 'echo "File: {}" && cat -n {} | sed -n "90,110p"'Repository: InfinityBowman/corates
Length of output: 991
Inconsistent error handling across PDF operations.
The store's view() function handles errors internally by updating pdfPreviewStore, but download() and deletePdfFromStudy() throw errors to the component. Meanwhile, the component handlers for these operations (lines 62-76) have no try-catch blocks, unlike handleFileSelect() which wraps the upload with error feedback. This creates silent failures for users on download and delete.
Either add try-catch blocks in the component handlers (following the upload pattern) or move error handling to the store for consistency.
🤖 Prompt for AI Agents
In
packages/web/src/components/project-ui/all-studies-tab/study-card/StudyPdfSection.jsx
around lines 62 to 81, the PDF action handlers call store methods that can throw
but currently have no error handling; make each handler async, await the store
call (e.g., await projectActionsStore.pdf.download(...) and await
projectActionsStore.pdf.delete(...)), wrap the await in try-catch, and in the
catch block log the error and surface user feedback (e.g., show the same
toast/notification used in handleFileSelect or a visible error message) so
download/delete failures are not silent.
…com/InfinityBowman/corates into 104-refactor-project-state-handlers
Summary by CodeRabbit
Chores
Refactor
User-facing changes / Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.