-
Notifications
You must be signed in to change notification settings - Fork 0
feat(wikibase-schema-editor): integrate drag-drop composable #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Warning Rate limit exceeded@DaxServer has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 6 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis change migrates drag-and-drop state management in the schema editor frontend from a local composable to a new global Pinia store ( Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant useDragDropContext
participant useDragDropStore
UI->>useDragDropContext: Initiate drag (startDrag)
useDragDropContext->>useDragDropStore: startDrag(column)
useDragDropStore-->>useDragDropContext: Updates state
UI->>useDragDropContext: Enter drop zone (enterDropZone)
useDragDropContext->>useDragDropStore: setHoveredTarget(targetPath)
useDragDropStore-->>useDragDropContext: Updates hovered target
UI->>useDragDropContext: Perform drop (performDrop)
useDragDropContext->>useDragDropStore: setDragState("dropping")
useDragDropContext->>useDragDropStore: endDrag()
useDragDropStore-->>useDragDropContext: Resets drag state
Possibly related PRs
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
frontend/src/composables/useDragDropContext.ts (1)
34-54: Duplicate compatibility mapping logic.The
isDataTypeCompatiblefunction contains the same compatibility mapping that exists in the store (lines 37-52 and 111-126 in the store). This violates the DRY principle and could lead to maintenance issues.Consider refactoring to reuse the compatibility logic from the store. You could either:
- Export a helper function from the store that both the store and composable can use
- Move the validation logic entirely to the store and have the composable call store methods
Example approach:
-const isDataTypeCompatible = (columnType: string, acceptedTypes: WikibaseDataType[]): boolean => { - const compatibilityMap: Record<string, WikibaseDataType[]> = { - VARCHAR: ['string', 'url', 'external-id', 'monolingualtext'], - // ... duplicate mapping - } - - const compatibleTypes = compatibilityMap[columnType.toUpperCase()] || [] - return acceptedTypes.some((type) => compatibleTypes.includes(type)) -} +const isDataTypeCompatible = (columnType: string, acceptedTypes: WikibaseDataType[]): boolean => { + const store = useDragDropStore() + // Create a mock column to leverage the store's validation logic + const mockColumn: ColumnInfo = { + name: '', + dataType: columnType, + nullable: false, + sampleValues: [] + } + const mockTarget: DropTarget = { + type: 'statement', + path: '', + acceptedTypes, + propertyId: 'P1' + } + // Use the store's validation logic + return store.getValidTargetsForColumn(mockColumn).some( + target => target.acceptedTypes.some(type => acceptedTypes.includes(type)) + ) +}
🧹 Nitpick comments (4)
frontend/tsconfig.vite.json (1)
18-18: Global@types/nodein a browser-facing config can mask misuse of Node-only APIsKeeping
"types": ["node"]makes
Buffer,process, etc. compile in everysrc/**/*.ts|vuefile matched by this config.
That may silently ship Node-specific code to the browser bundle.
Typical pattern:"types": ["node"], "typeRoots": ["./types"], // limit to config/cli only "exclude": ["src/**/*"] // or move the Node config to a separate tsconfig.node.jsonUnless you intentionally need Node globals in your runtime code, consider scoping them to build scripts instead.
frontend/tsconfig.app.json (2)
15-19: Redundantlibdefinition – already provided by@vue/tsconfig/tsconfig.dom.json
tsconfig.dom.jsonthat you extend at line 2 already sets"lib": ["dom", "esnext"]Re-declaring the same array here adds maintenance overhead and risks divergence between configs.
You can safely drop the block below to inherit the upstream defaults:- "lib": [ - "esnext", - "dom" - ]
14-16: Missing comma after closing brace will break JSON5 toolingThere is no comma between the
"lib"block (now suggested for removal) and the closing brace of"compilerOptions".
If you decide to keep additional properties later, ensure the trailing comma on"tsBuildInfoFile"stays consistent.frontend/src/composables/useDragDropContext.ts (1)
186-198: TODO: Implement actual drop operation logic.The current implementation contains placeholder logic that simulates an async operation. The comments indicate this should be replaced with actual implementation such as API calls or store updates.
Would you like me to help implement the actual drop operation logic or create an issue to track this TODO?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
.kiro/specs/wikibase-schema-editor/tasks.md(1 hunks)frontend/.eslintrc-auto-import.json(1 hunks)frontend/auto-imports.d.ts(2 hunks)frontend/src/composables/__tests__/useDragDropContext.test.ts(10 hunks)frontend/src/composables/useDragDropContext.ts(6 hunks)frontend/src/stores/__tests__/drag-drop.store.test.ts(1 hunks)frontend/src/stores/drag-drop.store.ts(1 hunks)frontend/src/types/drag-drop.ts(1 hunks)frontend/tsconfig.app.json(1 hunks)frontend/tsconfig.vite.json(1 hunks)package.json(0 hunks)
💤 Files with no reviewable changes (1)
- package.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.test.{ts,tsx,js,jsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
.kiro/specs/wikibase-schema-editor/tasks.md (1)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
frontend/.eslintrc-auto-import.json (4)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: Applies to **/*.{tsx,jsx,js} : Import .css files directly in .tsx, .jsx, or .js files and Bun will handle them
frontend/tsconfig.vite.json (11)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for building HTML, TypeScript, or CSS files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in `WebSocket` instead of `ws`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.html : HTML files can import .tsx, .jsx, or .js files directly and Bun's bundler will transpile & bundle automatically
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs`'s readFile/writeFile
frontend/tsconfig.app.json (10)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for building HTML, TypeScript, or CSS files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{html,tsx,jsx,js,css} : Use HTML imports with `Bun.serve()` instead of `vite` for frontend development
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Do not use dotenv; Bun automatically loads .env files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/auto-imports.d.ts (14)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use readonly and shallowReactive for large or expensive data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use v-memo, shallowRef, markRaw, and Suspense for performance optimization
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Prefer composables over methods in Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
frontend/src/composables/__tests__/useDragDropContext.test.ts (10)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: For more information, read the official Bun documentation at https://bun.sh/docs or check `node_modules/bun-types/docs/**.md` if available locally
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.sql` for Postgres instead of `pg` or `postgres.js`
frontend/src/types/drag-drop.ts (2)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Props and emits must use explicit TypeScript interfaces
frontend/src/stores/__tests__/drag-drop.store.test.ts (4)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
frontend/src/composables/useDragDropContext.ts (13)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use v-memo, shallowRef, markRaw, and Suspense for performance optimization
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{ts,vue} : Type safety everywhere
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Prefer reactivity over computed unless necessary
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use readonly and shallowReactive for large or expensive data
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use reactive objects for form state and errors
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Vue 3 with Composition API and <script setup lang="ts"> in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
frontend/src/stores/drag-drop.store.ts (5)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
🧬 Code Graph Analysis (3)
frontend/auto-imports.d.ts (1)
frontend/src/stores/drag-drop.store.ts (1)
useDragDropStore(9-201)
frontend/src/composables/__tests__/useDragDropContext.test.ts (2)
frontend/src/composables/useDragDropContext.ts (1)
useDragDropContext(60-278)frontend/src/stores/drag-drop.store.ts (1)
useDragDropStore(9-201)
frontend/src/stores/drag-drop.store.ts (2)
frontend/auto-imports.d.ts (4)
ColumnInfo(359-359)DragState(353-353)DropTarget(353-353)WikibaseDataType(359-359)frontend/src/types/drag-drop.ts (2)
DragState(53-53)DropTarget(35-42)
🪛 Biome (1.9.4)
frontend/src/stores/drag-drop.store.ts
[error] 64-64: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 65-67: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 144-144: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 145-145: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
🔇 Additional comments (18)
frontend/tsconfig.vite.json (1)
18-22: Overridinglibdrops everything that@tsconfig/node22pre-configured – are you sure this is intended?
@tsconfig/node22/tsconfig.jsonships with"lib": ["es2022"]By adding a new
libarray you REPLACE (not merge) that list, so every ES-2022-only built-in (e.g.AggregateError,Awaited) vanishes from the compile target unless it is also present in"esnext".
If the goal is just to add DOM typings, consider extending the list instead of replacing it:- "lib": [ - "esnext", - "dom" - ] + "lib": [ + "es2022", + "esnext", + "dom" + ]Please double-check that no server-side utilities rely on ES-2022 globals imported via this config.
.kiro/specs/wikibase-schema-editor/tasks.md (1)
33-33: Task completion appropriately documented.The marking of task 6 as complete correctly reflects the implementation of the drag-and-drop composable functionality described in this PR.
frontend/.eslintrc-auto-import.json (1)
239-239: Correctly adds auto-import configuration for the new store.The addition of
useDragDropStoreto the globals enables seamless usage across the frontend codebase without explicit imports, following the established auto-import pattern.frontend/auto-imports.d.ts (2)
184-184: Proper TypeScript declaration for global store access.The global constant declaration enables type-safe usage of
useDragDropStorethroughout the application.
542-542: Correct Vue component property declaration.The component custom property declaration ensures
useDragDropStoreis available with proper typing in Vue component templates and instances.frontend/src/types/drag-drop.ts (1)
5-10: Well-designed separation of concerns in interface definition.The clarifying comment and simplified interface properly distinguish between local composable state and global store state. Retaining only
isOverDropZoneanddropFeedbackas local UI state follows good architectural principles.frontend/src/composables/__tests__/useDragDropContext.test.ts (6)
2-4: Proper test setup for store integration.The addition of Pinia imports and store import correctly supports the new architecture where the composable delegates to the global store.
13-13: Correct Pinia initialization for testing.Setting up Pinia in
beforeEachensures each test has a fresh store instance, following testing best practices.
33-39: Appropriate focus on local composable state.The test correctly focuses on what the composable now owns (local drop zone state) rather than global drag state, reflecting the architectural separation of concerns.
72-74: Correct delegation to store for target management.Using
store.setAvailableTargets()instead of composable methods properly reflects that target management is now handled by the global store.
227-251: Well-structured store delegation testing.The test correctly validates that target computation is delegated to the store while maintaining the same functional behavior.
264-297: Comprehensive method presence verification.The new tests properly verify that both composable methods and store methods are available and functional, ensuring the integration works correctly.
frontend/src/stores/__tests__/drag-drop.store.test.ts (2)
1-53: Well-structured test setup with proper isolation.The test setup correctly uses
bun:testas per the coding guidelines and properly initializes a fresh Pinia instance for each test, ensuring proper test isolation. The mock data is comprehensive and covers various drop target scenarios.
55-424: Comprehensive test coverage for the drag-drop store.The test suite thoroughly covers all aspects of the store including:
- State initialization and transitions
- Drag lifecycle management
- Target validation with edge cases (nullable columns, length constraints, missing property IDs)
- All computed properties
- Data type compatibility mapping
- Store reset functionality
The tests are well-organized and provide excellent coverage for the new global drag-drop state management.
frontend/src/composables/useDragDropContext.ts (2)
1-2: Correct integration with the global drag-drop store.The composable properly imports and uses the
useDragDropStorefollowing the architectural pattern of using Pinia stores for global state management while keeping local state (isOverDropZone, dropFeedback) within the composable.Also applies to: 68-69
77-136: Well-refactored drag lifecycle methods.The methods correctly delegate global state management to the store while maintaining appropriate local state:
- Good use of WeakMap for event listener cleanup
- Proper separation between global state (in store) and local state (isOverDropZone, dropFeedback)
- Clean integration with the store's actions
frontend/src/stores/drag-drop.store.ts (2)
1-29: Well-structured Pinia store implementation.The store correctly uses the composition API pattern with proper reactive state management and computed properties. The structure follows Pinia best practices and aligns with the coding guidelines for using Pinia stores for global state.
80-106: Well-implemented store actions and exports.The store actions follow the single responsibility principle and provide a clean API for managing drag-drop state. The
$resetmethod properly clears all state, and the exports are comprehensive and well-organized.Also applies to: 162-201
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
frontend/src/stores/drag-drop.store.ts (2)
45-61: Fix switch statement variable declarations to prevent scope leakage.Variables declared in switch cases without blocks can be accessed by other cases, causing potential scope issues.
Apply this fix to wrap the declarations in blocks:
switch (target.type) { case 'label': - case 'alias': { + case 'alias': { const maxLength = target.type === 'label' ? 250 : 100 const hasLongValues = draggedColumn.value.sampleValues?.some( (val) => val.length > maxLength, ) if (hasLongValues) return false break + } case 'statement': case 'qualifier': - case 'reference': { + case 'reference': { if (!target.propertyId) return false break + } }
109-124: Fix switch statement variable declarations.The same variable declaration issue exists here as well.
Apply this fix:
switch (target.type) { case 'label': - case 'alias': + case 'alias': { const maxLength = target.type === 'label' ? 250 : 100 const hasLongValues = column.sampleValues?.some((val) => val.length > maxLength) if (hasLongValues) return false break + } case 'statement': case 'qualifier': - case 'reference': + case 'reference': { if (!target.propertyId) return false break + } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
frontend/.eslintrc-auto-import.json(3 hunks)frontend/auto-imports.d.ts(6 hunks)frontend/src/composables/__tests__/useSchemaApi.test.ts(2 hunks)frontend/src/composables/useDragDropContext.ts(6 hunks)frontend/src/stores/drag-drop.store.ts(1 hunks)frontend/src/types/__tests__/drop-target-validation.test.ts(6 hunks)frontend/src/utils/data-type-compatibility.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- frontend/.eslintrc-auto-import.json
- frontend/auto-imports.d.ts
- frontend/src/composables/useDragDropContext.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.test.{ts,tsx,js,jsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/src/composables/__tests__/useSchemaApi.test.ts (6)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
frontend/src/types/__tests__/drop-target-validation.test.ts (7)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` for running tests
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: For more information, read the official Bun documentation at https://bun.sh/docs or check `node_modules/bun-types/docs/**.md` if available locally
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` for SQLite instead of `better-sqlite3`
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript or JavaScript files
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs`'s readFile/writeFile
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.126Z
Learning: Applies to **/*.{tsx,jsx,js} : Import .css files directly in .tsx, .jsx, or .js files and Bun will handle them
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-07-20T14:13:40.125Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` (e.g., `Bun.$`ls``) instead of execa for running shell commands
frontend/src/utils/data-type-compatibility.ts (1)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Always use backend-inferred types for API data
frontend/src/stores/drag-drop.store.ts (5)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
🧬 Code Graph Analysis (3)
frontend/src/types/__tests__/drop-target-validation.test.ts (1)
frontend/src/utils/data-type-compatibility.ts (1)
isDataTypeCompatible(39-45)
frontend/src/utils/data-type-compatibility.ts (1)
frontend/auto-imports.d.ts (1)
WikibaseDataType(362-362)
frontend/src/stores/drag-drop.store.ts (3)
frontend/auto-imports.d.ts (3)
ColumnInfo(362-362)DragState(356-356)DropTarget(356-356)frontend/src/types/drag-drop.ts (2)
DragState(53-53)DropTarget(35-42)frontend/src/utils/data-type-compatibility.ts (1)
getCompatibleWikibaseTypes(29-31)
🪛 GitHub Actions: Run tests
frontend/src/composables/__tests__/useSchemaApi.test.ts
[error] 1-1: Unknown error reported in test file. No further details provided.
🪛 Biome (1.9.4)
frontend/src/stores/drag-drop.store.ts
[error] 113-113: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 114-114: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
🔇 Additional comments (7)
frontend/src/types/__tests__/drop-target-validation.test.ts (1)
2-2: Excellent refactoring to use centralized utility function.The replacement of the local helper with the centralized
isDataTypeCompatibleutility function improves code reusability and maintainability. All test calls have been updated consistently to use the new function signature.Also applies to: 78-78, 90-90, 102-102, 121-121, 133-133
frontend/src/utils/data-type-compatibility.ts (3)
7-22: Well-designed compatibility mapping with comprehensive coverage.The
DATA_TYPE_COMPATIBILITY_MAPprovides thorough coverage of common database types and their Wikibase equivalents. The use ofas constensures type safety, and the mapping choices are logical (e.g., VARCHAR supporting multiple string-like types, numeric types mapping to quantity).
29-31: Robust helper function with proper defensive programming.The function correctly handles case-insensitive lookups and provides a safe fallback to an empty array for unknown types.
39-45: Clean and efficient compatibility check implementation.The function efficiently combines the type lookup with array intersection logic to determine compatibility.
frontend/src/stores/drag-drop.store.ts (3)
10-19: Excellent implementation of global drag-drop state management.The store correctly centralizes drag-drop state using Pinia, following the retrieved learnings about using stores for global state. The reactive state variables are well-organized and cover all necessary aspects of drag-drop operations.
94-129: Well-implemented target validation logic with proper separation of concerns.The
calculateValidTargetsfunction correctly uses the centralized utility function and implements comprehensive validation logic. The filtering approach is efficient and maintains good performance.
146-170: Proper store API design following Pinia composition patterns.The returned interface correctly exposes state, computed properties, and actions, providing a clean API for components to consume. This aligns with Pinia best practices and the retrieved learnings about store usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/test.yml(1 hunks)frontend/src/composables/__tests__/useSchemaApi.test.ts(5 hunks)frontend/src/composables/useSchemaApi.ts(1 hunks)frontend/src/composables/useSchemaBuilder.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/test.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/src/composables/tests/useSchemaApi.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
**/*.{html,ts,tsx,css}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use Pinia stores for global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not proxy or export Pinia store state/actions from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.690Z
Learning: Applies to src/**/*.vue : Use Pinia for state management in all Vue components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use auto-imports for Vue, Pinia, composables, and utilities
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.vue : Use storeToRefs for state in components
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Use composables for logic that is not global state
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Place composables in the composables/ directory
frontend/src/composables/useSchemaApi.ts (2)
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/**/*.{vue,ts} : Use useApi composable (Elysia Eden) for all API calls
Learnt from: CR
PR: DaxServer/dataforge#0
File: .cursor/rules/frontend-setup.rule.md:0-0
Timestamp: 2025-07-20T14:13:24.691Z
Learning: Applies to src/composables/**/*.ts : Do not export store state from composables
🪛 GitHub Check: test
frontend/src/composables/useSchemaApi.ts
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:69:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
🔇 Additional comments (2)
frontend/src/composables/useSchemaBuilder.ts (1)
114-114: LGTM! Property name consistency improvement.The renaming from
wikibaseUrltowikibasealigns the parsed schema output with the internal property naming used in the schema structure, improving consistency across the codebase.frontend/src/composables/useSchemaApi.ts (1)
23-23: Property rename aligns with schema builder changes.The change from
wikibaseUrltowikibasemaintains consistency with the property renaming in the schema builder composable.
| const parsedSchema = parseSchema(schema) | ||
|
|
||
| schemaStore.schemaId = parsedSchema.id | ||
| schemaStore.projectId = parsedSchema.projectId | ||
| schemaStore.schemaName = parsedSchema.name | ||
| schemaStore.wikibase = parsedSchema.wikibase | ||
| schemaStore.labels = parsedSchema.labels | ||
| schemaStore.descriptions = parsedSchema.descriptions | ||
| schemaStore.aliases = parsedSchema.aliases | ||
| schemaStore.statements = parsedSchema.statements | ||
| schemaStore.createdAt = parsedSchema.createdAt | ||
| schemaStore.updatedAt = parsedSchema.updatedAt | ||
| schemaStore.isDirty = false | ||
| schemaStore.lastSaved = new Date(updatedAt) | ||
| schemaStore.lastSaved = new Date(parsedSchema.updatedAt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null safety check for parsed schema result.
The refactoring to use a single parsedSchema variable improves readability and the property rename to wikibase maintains consistency. However, the static analysis reveals critical runtime errors where parsedSchema is undefined when accessing its properties.
Add a safety check to handle cases where parseSchema returns undefined:
const loadSchemaIntoStore = (schema: WikibaseSchemaMapping) => {
const parsedSchema = parseSchema(schema)
+
+ if (!parsedSchema) {
+ console.error('Failed to parse schema:', schema)
+ return
+ }
schemaStore.schemaId = parsedSchema.id
schemaStore.projectId = parsedSchema.projectId
schemaStore.schemaName = parsedSchema.name
schemaStore.wikibase = parsedSchema.wikibase
schemaStore.labels = parsedSchema.labels
schemaStore.descriptions = parsedSchema.descriptions
schemaStore.aliases = parsedSchema.aliases
schemaStore.statements = parsedSchema.statements
schemaStore.createdAt = parsedSchema.createdAt
schemaStore.updatedAt = parsedSchema.updatedAt
schemaStore.isDirty = false
schemaStore.lastSaved = new Date(parsedSchema.updatedAt)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const parsedSchema = parseSchema(schema) | |
| schemaStore.schemaId = parsedSchema.id | |
| schemaStore.projectId = parsedSchema.projectId | |
| schemaStore.schemaName = parsedSchema.name | |
| schemaStore.wikibase = parsedSchema.wikibase | |
| schemaStore.labels = parsedSchema.labels | |
| schemaStore.descriptions = parsedSchema.descriptions | |
| schemaStore.aliases = parsedSchema.aliases | |
| schemaStore.statements = parsedSchema.statements | |
| schemaStore.createdAt = parsedSchema.createdAt | |
| schemaStore.updatedAt = parsedSchema.updatedAt | |
| schemaStore.isDirty = false | |
| schemaStore.lastSaved = new Date(updatedAt) | |
| schemaStore.lastSaved = new Date(parsedSchema.updatedAt) | |
| const parsedSchema = parseSchema(schema) | |
| if (!parsedSchema) { | |
| console.error('Failed to parse schema:', schema) | |
| return | |
| } | |
| schemaStore.schemaId = parsedSchema.id | |
| schemaStore.projectId = parsedSchema.projectId | |
| schemaStore.schemaName = parsedSchema.name | |
| schemaStore.wikibase = parsedSchema.wikibase | |
| schemaStore.labels = parsedSchema.labels | |
| schemaStore.descriptions = parsedSchema.descriptions | |
| schemaStore.aliases = parsedSchema.aliases | |
| schemaStore.statements = parsedSchema.statements | |
| schemaStore.createdAt = parsedSchema.createdAt | |
| schemaStore.updatedAt = parsedSchema.updatedAt | |
| schemaStore.isDirty = false | |
| schemaStore.lastSaved = new Date(parsedSchema.updatedAt) |
🧰 Tools
🪛 GitHub Check: test
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:92:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:69:7)
[failure] 20-20: TypeError: undefined is not an object (evaluating 'parsedSchema.id')
at loadSchemaIntoStore (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:20:28)
at <anonymous> (/home/runner/work/dataforge/dataforge/frontend/src/composables/useSchemaApi.ts:44:7)
🤖 Prompt for AI Agents
In frontend/src/composables/useSchemaApi.ts around lines 18 to 31, the code
assigns properties from parsedSchema without checking if parsedSchema is
undefined, which can cause runtime errors. Add a null safety check after calling
parseSchema to verify parsedSchema is defined before accessing its properties.
If parsedSchema is undefined, handle the case appropriately, such as returning
early or setting default values, to prevent runtime exceptions.
Addresses Task 6 of #66