Skip to content

add tanstack query#193

Merged
InfinityBowman merged 3 commits into
mainfrom
134-migrate-to-tanstack-query
Dec 29, 2025
Merged

add tanstack query#193
InfinityBowman merged 3 commits into
mainfrom
134-migrate-to-tanstack-query

Conversation

@InfinityBowman
Copy link
Copy Markdown
Owner

@InfinityBowman InfinityBowman commented Dec 29, 2025

Summary by CodeRabbit

  • New Features

    • Offline-first query persistence using IndexedDB with a localStorage fallback for faster access when offline.
  • Improvements

    • App-wide query-driven data fetching for more consistent, automatic refreshes (projects, admin, storage, subscription).
    • Better loading states and refresh behavior (faster, clearer UI during fetches and after invites/creates/deletes).
  • Bug Fixes

    • Minor logging cleanups and reduced noisy console output.

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

@InfinityBowman InfinityBowman linked an issue Dec 29, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 29, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Migrates many data flows from a local projectStore/createResource model to TanStack Solid Query: adds a singleton QueryClient with IndexedDB persistence, introduces queryKeys and query hooks, updates components to use queries and invalidation, and removes the project list offline cache from projectStore.

Changes

Cohort / File(s) Summary
Query infrastructure
packages/web/src/lib/queryClient.js, packages/web/src/lib/queryPersister.js, packages/web/src/lib/queryKeys.js
Add singleton QueryClient with offline-first defaults, IndexedDB persister (with localStorage fallback), periodic persistence, and centralized queryKeys factory.
App bootstrap
packages/web/src/main.jsx
Wrap app with QueryClientProvider using the new queryClient.
New query hooks
packages/web/src/primitives/useProjectList.js, packages/web/src/primitives/useAdminQueries.js
Add useProjectList (project list fetching, offline reconciliation, retry queue) and admin hooks (useAdminStats, useAdminUsers, useAdminUserDetails, useStorageDocuments, useStorageStats).
Component migrations
packages/web/src/components/project/ProjectDashboard.jsx, packages/web/src/components/sidebar/Sidebar.jsx, packages/web/src/components/admin/AdminDashboard.jsx, packages/web/src/components/admin/StorageManagement.jsx
Replace createResource/projectStore usage with TanStack Query hooks; adjust loading/error/refetch flows and use query invalidation on updates.
Auth / lifecycle handlers
packages/web/src/api/better-auth-store.js, packages/web/src/lib/bfcache-handler.js
Replace projectStore refresh/clear calls with queryClient.invalidateQueries / removeQueries; add auth-ready handling on bfcache restore.
Project primitives & stores
packages/web/src/primitives/useProject/index.js, packages/web/src/primitives/useProject/studies.js, packages/web/src/stores/projectActionsStore/*, packages/web/src/primitives/useSubscription.js
Remove stale-project cleanup registration, invalidate project list queries after mutations, migrate subscription from createResource to useQuery, and update member/project delete flows to invalidate queries rather than mutate store.
Project store removal
packages/web/src/stores/projectStore.js
Remove the project list/dashboard offline cache and all list-related APIs; retain core project accessors.
Small/no-op log or comment changes
packages/landing/public/sw.js, packages/landing/scripts/version-sw.js, packages/web/src/api/google-drive.js, packages/web/src/components/*
Minor console.log → console.info switches and removed debug logs/comments.
Dependencies
packages/web/package.json
Add @tanstack/solid-query and idb.

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant App as App (UI)
participant Query as QueryClient
participant Persister as IndexedDB Persister
participant LS as localStorage
Note over App,Query: App initializes and mounts QueryClientProvider
App->>Query: getQueryClient()
Query->>Persister: setupPersistence(restore)
Persister-->>Query: restored queries (if any)
alt restored snapshot exists
Query->>App: provide cached query results
end
Note over App,Query: User triggers data mutation (create/rename/delete)
App->>Query: mutation call
Query->>Query: update cache & schedule persist
Query->>Persister: debounce persist (periodic)
Par persist to disk and snapshot
Persister-->>LS: (optionally) write fallback snapshot
Persister-->>IndexedDB: write full persisted state
end
Note over App,Query: On auth/logout or bfcache restore
App->>Query: invalidateQueries / removeQueries
Query->>Persister: optionally remove or update persisted entries

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 A hop from store to query, tap-tap on the key,
IndexedDB stores our carrots safe and free,
Invalidate, refetch — the dance of cache delight,
Queries hum softly through the day and night,
A rabbit cheers: new keys, new sync — what a sight! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add tanstack query' accurately describes the main objective of the pull request, which is to migrate the application from a custom project store to TanStack Query for state management across multiple components and modules.
Docstring Coverage ✅ Passed Docstring coverage is 92.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3406ea1 and b530abf.

📒 Files selected for processing (9)
  • packages/landing/public/sw.js
  • packages/landing/scripts/version-sw.js
  • packages/web/src/api/google-drive.js
  • packages/web/src/components/checklist/ChecklistYjsWrapper.jsx
  • packages/web/src/components/profile/ProfilePage.jsx
  • packages/web/src/components/project/google-drive/GoogleDrivePickerLauncher.jsx
  • packages/web/src/components/project/google-drive/GoogleDrivePickerModal.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryClient.js

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

cloudflare-workers-and-pages Bot commented Dec 29, 2025

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 b530abf Commit Preview URL Dec 29 2025, 11:46 PM

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/web/src/components/admin/AdminDashboard.jsx (1)

157-157: Fix incorrect loading state check.

usersData is a function that returns the query data, not the query object itself. The loading state should be checked on usersDataQuery.

Proposed fix
             <Show
-              when={!usersData.loading}
+              when={!usersDataQuery.isLoading}
               fallback={
packages/web/src/stores/projectActionsStore/project.js (1)

57-81: Unused shouldNavigate parameter passed to deleteById.

The deleteProject function passes shouldNavigate to deleteById (line 80), but deleteById only accepts targetProjectId (line 57). The second argument is silently ignored.

Either remove the unused parameter from the call, or update deleteById to accept and use shouldNavigate if navigation is intended.

Proposed fix (remove unused arg)
   async function deleteProject(shouldNavigate = true) {
     const projectId = getActiveProjectId();
-    return deleteById(projectId, shouldNavigate);
+    return deleteById(projectId);
   }
packages/web/src/components/project/ProjectDashboard.jsx (1)

68-71: Error type mismatch will cause runtime failure.

isOfflineError treats error() as a string by calling .includes(), but TanStack Query returns Error objects, and line 195 also expects an object with .message. Calling .includes() on an Error object will throw a TypeError.

Proposed fix
 const isOfflineError = () => {
   const err = error();
-  return err && (err.includes('No internet connection') || err.includes('connection error'));
+  const message = err?.message || '';
+  return err && (message.includes('No internet connection') || message.includes('connection error'));
 };
🧹 Nitpick comments (3)
packages/web/src/lib/queryPersister.js (1)

22-28: Consider adding error handling for blocked database upgrades.

The openDB call's upgrade callback doesn't handle the case where the database might be blocked by another tab. While rare, adding an onblocked handler could improve resilience.

Optional enhancement
     dbPromise = openDB(DB_NAME, DB_VERSION, {
       upgrade(db) {
         if (!db.objectStoreNames.contains(STORE_NAME)) {
           db.createObjectStore(STORE_NAME);
         }
       },
+      blocked() {
+        console.warn('[queryPersister] Database upgrade blocked by another tab');
+      },
     });
packages/web/src/primitives/useAdminQueries.js (1)

13-23: Refactor adminFetch to use handleFetchError utility.

Per coding guidelines for frontend fetch calls in packages/web, wrap the fetch promise with handleFetchError from @/lib/error-utils.js instead of inline error handling. This ensures consistent error handling, proper domain vs. transport error distinction, and optional toast notifications across the application.

packages/web/src/primitives/useSubscription.js (1)

67-69: Redundant placeholderData: undefined.

Setting placeholderData to undefined is the default behavior and can be removed to reduce noise.

Proposed fix
     staleTime: 1000 * 60 * 5, // 5 minutes
     gcTime: 1000 * 60 * 10, // 10 minutes
-    // Use placeholderData so components can check loading state
-    // placeholderData is only used while loading, not as initial data
-    placeholderData: undefined,
   }));
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f78c776 and 3406ea1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • packages/web/package.json
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/main.jsx
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectStore.js
💤 Files with no reviewable changes (1)
  • packages/web/src/stores/projectStore.js
🧰 Additional context used
📓 Path-based instructions (17)
packages/web/**/!(*.test|*.spec).{js,ts,jsx,tsx}

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

packages/web/**/!(*.test|*.spec).{js,ts,jsx,tsx}: Always use handleFetchError from @/lib/error-utils.js for frontend fetch calls with optional showToast parameter
Use createFormErrorSignals from @/lib/form-errors.js for handling form validation errors, field-level errors, and global errors in frontend forms

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
packages/{web,workers}/**/!(*.test|*.spec).{js,ts,jsx,tsx}

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

packages/{web,workers}/**/!(*.test|*.spec).{js,ts,jsx,tsx}: Never throw string literals; always throw Error objects or return domain errors from API routes
Use isErrorCode utility from @corates/shared or @/lib/error-utils.js to check for specific error codes instead of manual error comparisons

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
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/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
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

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.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/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
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/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
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/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
**/*.{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

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
**/*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*: NEVER use emojis anywhere - not in code, comments, documentation, plan files, commit messages, or examples
Do NOT use unicode symbols - unicode symbols are forbidden anywhere in the codebase

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/package.json
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
**/*.{ts,tsx,jsx,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,jsx,js}: For UI icons, use solid-icons library or SVGs only (never emojis)
Prefer modern ES6+ syntax and features
Use import aliases from jsconfig.json as defined in the ui-components.mdc documentation
Prefer config files over hardcoding values
Ensure browser compatibility (Safari is usually problematic)
Group related components in subdirectories with barrel exports
Use Ark UI components from @corates/ui package, not local component implementations
Use solid-icons icon library (e.g., solid-icons/bi, solid-icons/fi) for icons
Comments should explain WHY something is being done, not WHAT the code is doing
Comment to explain why a particular approach or workaround was chosen
Comment to clarify intent when code could be misread or misunderstood
Comment to provide context from external systems, specs, or requirements
Comment to document assumptions, edge cases, or limitations
Do NOT comment by narrating what the code is doing
Do NOT duplicate function or variable names in plain English comments
Do NOT leave stale comments that contradict the code
Do NOT reference removed or obsolete code paths in comments

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)

Prefer modern ES6+ syntax and features

Files:

  • packages/web/src/lib/queryClient.js
  • packages/web/src/lib/queryKeys.js
  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useAdminQueries.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useSubscription.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
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

Files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/main.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.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/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/main.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
packages/web/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/web/**/*.{ts,tsx,jsx}: 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
SolidJS components should receive at most 1-5 props (local config only, not shared state)
Move business logic to stores, utilities, or primitives (not in components) in SolidJS

Files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/main.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)

For UI icons, use solid-icons library or SVGs only (never emojis)

Files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/main.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
packages/web/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)

packages/web/src/**/*.{ts,tsx,jsx}: Use import aliases from jsconfig.json
Use Ark UI components from @corates/ui package, NOT local components
Do NOT prop-drill application state; import stores directly where needed
Use createMemo for derived values
Move business logic to stores, utilities, or primitives (not components)

Files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/main.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
packages/web/src/components/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/corates.mdc)

packages/web/src/components/**/*.{ts,tsx,jsx}: Group related components in subdirectories with barrel exports
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)

Files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
🧠 Learnings (53)
📓 Common learnings
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
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
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to 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
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 : When access is denied (user removed or project deleted), the connection automatically triggers cleanup: IndexedDB data cleared, connection closed, store cleared, and user redirected
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
📚 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/admin/StorageManagement.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/admin/StorageManagement.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to packages/web/**/*.{ts,tsx} : Use `createStore` for complex state objects in SolidJS

Applied to files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useProject/index.js
  • 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/**}/**/*.{js,jsx,ts,tsx} : Use createSignal for simple reactive values in SolidJS components

Applied to files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/components/admin/AdminDashboard.jsx
  • packages/web/src/api/better-auth-store.js
  • 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/**}/**/*.{js,jsx,ts,tsx} : Use createStore for complex objects and arrays that need granular reactivity in SolidJS

Applied to files:

  • packages/web/src/components/admin/StorageManagement.jsx
  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/**/*.{js,jsx} : For temporary File object storage during OAuth flows (e.g., pending PDFs), use projectStore.setPendingProjectData() instead of IndexedDB, as File objects cannot be serialized

Applied to files:

  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.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 : When access is denied (user removed or project deleted), the connection automatically triggers cleanup: IndexedDB data cleared, connection closed, store cleared, and user redirected

Applied to files:

  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 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 `cachePdf` and `getCachedPdf` from `primitives/pdfCache.js` for caching PDF data in IndexedDB

Applied to files:

  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/primitives/useAdminQueries.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} : Implement PDF caching strategy: check cache first, download from server if not cached, then cache the downloaded PDF

Applied to files:

  • packages/web/src/lib/bfcache-handler.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/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.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 **/*.{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/lib/bfcache-handler.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.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/lib/bfcache-handler.js
  • packages/web/src/lib/queryPersister.js
  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T03:01:35.601Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/durable-objects.mdc:0-0
Timestamp: 2025-12-27T03:01:35.601Z
Learning: Applies to packages/workers/src/durable-objects/**/ProjectDoc.{js,ts} : Verify authentication before WebSocket upgrade in ProjectDoc

Applied to files:

  • packages/web/src/lib/bfcache-handler.js
  • packages/web/src/api/better-auth-store.js
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/**/*.{js,jsx} : Only save serializable data to IndexedDB—exclude File objects, ArrayBuffers, functions, and other non-serializable objects from form state persistence

Applied to files:

  • packages/web/src/lib/queryPersister.js
  • packages/web/src/main.jsx
📚 Learning: 2025-12-27T03:01:35.601Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/durable-objects.mdc:0-0
Timestamp: 2025-12-27T03:01:35.601Z
Learning: Applies to packages/workers/src/durable-objects/**/*.{js,ts} : Persist Y.Doc state to Durable Object storage using Y.encodeStateAsUpdate() on document updates

Applied to files:

  • packages/web/src/lib/queryPersister.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} : Use Solid's Show component for conditional rendering instead of ternary operators

Applied to files:

  • packages/web/src/components/admin/AdminDashboard.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/**}/**/*.{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/admin/AdminDashboard.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/components/sidebar/Sidebar.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/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/primitives/useProjectList.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.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} : Use the `useProject` hook for managing Yjs connections with reference counting instead of creating Y.Doc instances directly

Applied to files:

  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.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/primitives/useProjectList.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 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 `addPdfToStudy` operation from `useProject` hook to add PDFs to a study, passing id, name, size, tag, uploadedAt, and uploadedBy

Applied to files:

  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/primitives/useProject/studies.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 `removePdfFromStudy` operation from `useProject` hook to remove PDFs from a study

Applied to files:

  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.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/primitives/useProjectList.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.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 **/*.{js,jsx,ts,tsx} : Use operation functions from useProject or projectActionsStore for writing data instead of directly modifying Y.Doc

Applied to files:

  • packages/web/src/primitives/useProjectList.js
  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.js
  • packages/web/src/components/sidebar/Sidebar.jsx
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to packages/web/**/*.{ts,tsx,jsx} : Do NOT prop-drill application state in SolidJS - import stores directly where needed

Applied to files:

  • packages/web/src/main.jsx
  • packages/web/src/api/better-auth-store.js
  • packages/web/package.json
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/**/*.{js,jsx} : 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

Applied to files:

  • packages/web/src/main.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} : Handle connection cleanup via onCleanup() in Solid.js components or equivalent cleanup patterns, calling disconnect() when the component unmounts

Applied to files:

  • packages/web/src/main.jsx
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to 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

Applied to files:

  • packages/web/src/main.jsx
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/**/*.{js,jsx} : Clear URL restore parameters after form state restoration by calling clearRestoreParamsFromUrl() to prevent stale restoration attempts on subsequent navigation

Applied to files:

  • packages/web/src/main.jsx
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/**/*.{js,jsx} : 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()

Applied to files:

  • packages/web/src/main.jsx
📚 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} : Save form state using `saveFormState` from `@/lib/formStatePersistence.js` before triggering OAuth redirects for Google Drive

Applied to files:

  • packages/web/src/main.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} : Always clean up SolidJS effects that create subscriptions or timers using onCleanup

Applied to files:

  • packages/web/src/main.jsx
📚 Learning: 2025-12-27T15:42:18.945Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/corates.mdc:0-0
Timestamp: 2025-12-27T15:42:18.945Z
Learning: Applies to packages/workers/src/**/*.{ts,tsx} : Use Better-Auth for authentication and user management

Applied to files:

  • packages/web/src/api/better-auth-store.js
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to packages/workers/**/*.{ts,tsx} : Use Better-Auth for authentication and user management

Applied to files:

  • packages/web/src/api/better-auth-store.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 : Never manually call syncFromYDoc() - sync from Y.Doc to store is handled automatically via ydoc.on('update')

Applied to files:

  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/stores/projectActionsStore/members.js
  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/primitives/useProject/studies.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/**}/**/*.{js,jsx,ts,tsx} : Prefer derived state with createMemo or signals over effects whenever possible

Applied to files:

  • packages/web/src/api/better-auth-store.js
  • 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/**}/**/*.{js,jsx,ts,tsx} : Use createMemo for computed/derived values that depend on reactive state in SolidJS

Applied to files:

  • packages/web/src/api/better-auth-store.js
  • packages/web/src/primitives/useSubscription.js
📚 Learning: 2025-12-27T03:01:35.601Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/durable-objects.mdc:0-0
Timestamp: 2025-12-27T03:01:35.601Z
Learning: Applies to packages/workers/src/durable-objects/**/ProjectDoc.{js,ts} : Check user membership in project before allowing WebSocket connection in ProjectDoc

Applied to files:

  • packages/web/src/api/better-auth-store.js
  • packages/web/src/stores/projectActionsStore/members.js
📚 Learning: 2025-12-27T03:01:54.727Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/form-state.mdc:0-0
Timestamp: 2025-12-27T03:01:54.727Z
Learning: Applies to packages/web/src/components/project-ui/**/*.{js,jsx} : Form state should include serializable metadata when handling files (name, size, type) and use the store's pendingPdfs pattern for actual File objects that persist across redirects

Applied to files:

  • packages/web/src/stores/projectActionsStore/project.js
  • packages/web/src/components/project/ProjectDashboard.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} : Access Y.Doc connection state via projectStore.getConnectionState(projectId) instead of checking connection state directly

Applied to files:

  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.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} : Don't store Y.Doc references in component state; always retrieve the connection through useProject

Applied to files:

  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.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/workers/src/durable-objects/ProjectDoc.js, packages/web/src/primitives/useProject/** : Y.Doc structure in ProjectDoc follows a specific hierarchy: meta (Map), members (Map), reviews (Map containing studies with checklists, pdfs, and reconciliation)

Applied to files:

  • packages/web/src/primitives/useProject/index.js
  • packages/web/src/primitives/useProject/studies.js
📚 Learning: 2025-12-27T03:02:33.023Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-12-27T03:02:33.023Z
Learning: Applies to packages/{web,ui}/**/*.{js,jsx,ts,tsx} : Use solid-icons library for icons instead of emojis or other icon sources

Applied to files:

  • packages/web/package.json
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to packages/web/**/*.{ts,tsx} : Use `createMemo` for derived values in SolidJS

Applied to files:

  • packages/web/package.json
📚 Learning: 2025-12-27T03:02:33.023Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-12-27T03:02:33.023Z
Learning: Applies to packages/{web,ui}/**/*.{js,jsx,ts,tsx} : Import UI components from 'corates/ui' package instead of local components directories

Applied to files:

  • packages/web/package.json
  • packages/web/src/components/project/ProjectDashboard.jsx
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to **/*.{ts,tsx,jsx,js} : Use `solid-icons` icon library (e.g., `solid-icons/bi`, `solid-icons/fi`) for icons

Applied to files:

  • packages/web/package.json
📚 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/project/ProjectDashboard.jsx
  • packages/web/src/components/sidebar/Sidebar.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} : Never create Y.Doc instances directly; always use the connection registry managed by useProject

Applied to files:

  • packages/web/src/components/project/ProjectDashboard.jsx
  • packages/web/src/primitives/useProject/studies.js
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to **/*.{ts,tsx,jsx,js} : Use Ark UI components from `corates/ui` package, not local component implementations

Applied to files:

  • packages/web/src/components/project/ProjectDashboard.jsx
📚 Learning: 2025-12-27T03:01:35.601Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .cursor/rules/durable-objects.mdc:0-0
Timestamp: 2025-12-27T03:01:35.601Z
Learning: Applies to packages/workers/src/durable-objects/**/ProjectDoc.{js,ts} : Use y-websocket protocol with message type 0 for Yjs sync messages in ProjectDoc

Applied to files:

  • packages/web/src/primitives/useProject/studies.js
📚 Learning: 2025-12-27T15:42:01.079Z
Learnt from: CR
Repo: InfinityBowman/corates PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T15:42:01.079Z
Learning: Applies to packages/web/**/*.{ts,tsx,jsx} : Move business logic to stores, utilities, or primitives (not in components) in SolidJS

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/sidebar/Sidebar.jsx
🧬 Code graph analysis (10)
packages/web/src/lib/queryClient.js (1)
packages/web/src/lib/queryPersister.js (1)
  • createIDBPersister (38-80)
packages/web/src/lib/queryKeys.js (3)
packages/web/src/components/project/ProjectDashboard.jsx (1)
  • userId (31-31)
packages/web/src/components/admin/AdminDashboard.jsx (2)
  • page (27-27)
  • search (26-26)
packages/web/src/components/admin/StorageManagement.jsx (4)
  • limit (56-56)
  • search (47-47)
  • cursor (49-49)
  • prefix (48-48)
packages/web/src/lib/bfcache-handler.js (4)
packages/web/src/components/project/ProjectDashboard.jsx (1)
  • queryClient (32-32)
packages/web/src/lib/queryClient.js (2)
  • queryClient (238-238)
  • queryClient (238-238)
packages/web/src/primitives/useSubscription.js (1)
  • queryClient (141-141)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/components/admin/AdminDashboard.jsx (3)
packages/web/src/primitives/useAdminQueries.js (2)
  • useAdminStats (28-35)
  • useAdminUsers (41-61)
packages/web/src/components/admin/StorageManagement.jsx (1)
  • debouncedSearch (51-51)
packages/web/src/components/admin/StatsCard.jsx (1)
  • StatsCard (30-51)
packages/web/src/primitives/useProjectList.js (2)
packages/web/src/primitives/useProject/index.js (1)
  • cleanupProjectLocalData (99-141)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/stores/projectActionsStore/members.js (2)
packages/web/src/lib/queryClient.js (2)
  • queryClient (238-238)
  • queryClient (238-238)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/primitives/useProject/index.js (3)
packages/web/src/stores/projectStore.js (1)
  • projectStore (275-275)
packages/web/src/lib/queryClient.js (2)
  • queryClient (238-238)
  • queryClient (238-238)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/primitives/useSubscription.js (2)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/lib/queryClient.js (2)
  • queryClient (238-238)
  • queryClient (238-238)
packages/web/src/primitives/useProject/studies.js (2)
packages/web/src/lib/queryClient.js (2)
  • queryClient (238-238)
  • queryClient (238-238)
packages/web/src/lib/queryKeys.js (2)
  • queryKeys (8-37)
  • queryKeys (8-37)
packages/web/src/components/sidebar/Sidebar.jsx (3)
packages/web/src/components/project/ProjectDashboard.jsx (1)
  • projectListQuery (35-35)
packages/web/src/primitives/useProjectList.js (1)
  • useProjectList (95-118)
packages/web/src/api/better-auth-store.js (1)
  • isLoggedIn (132-138)
⏰ 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

@InfinityBowman InfinityBowman merged commit cc566ed into main Dec 29, 2025
1 of 3 checks passed
@InfinityBowman InfinityBowman deleted the 134-migrate-to-tanstack-query branch December 29, 2025 23:44
@github-actions github-actions Bot restored the 134-migrate-to-tanstack-query branch December 29, 2025 23:45
@InfinityBowman InfinityBowman deleted the 134-migrate-to-tanstack-query branch January 5, 2026 18:40
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.

Migrate to tanstack query

2 participants