-
Notifications
You must be signed in to change notification settings - Fork 230
Resolve v1 drag-and-drop functionality by fixing module initialization #929
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
base: main
Are you sure you want to change the base?
Resolve v1 drag-and-drop functionality by fixing module initialization #929
Conversation
- Set Vite root to version-specific directory to ensure correct file loading - Update CSS import path in tutorials.scss to work with new root - Adjust build output directory to be relative to new root - Add filesystem access permission for parent directory in dev server - This fixes the issue where v0's files were loading instead of v1's files - Resolves drag-and-drop elements not working in v1 due to uninitialized modules
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Rate limit exceeded
⌛ 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. WalkthroughThe PR updates import paths for CSS dependencies from absolute root-based paths to relative paths across two SCSS files (tutorials.scss in both src and v1/src directories) and modifies the Vite configuration to adjust the project root based on the version variable and enable serving from parent directories. These changes address path resolution for the driver.js CSS dependency across different directory structures. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
🤖 Fix all issues with AI agents
In `@vite.config.ts`:
- Line 19: The Vite config sets root to `./${version}` which causes build.outDir
to be nested under the version folder; change the config to use a neutral root
(e.g., `.`) and explicitly set build.outDir to the version folder so outputs
land at dist/simulatorvue/<version>/ rather than
dist/simulatorvue/<version>/<version>/; update the vite.config.ts to remove or
change the `root` assignment (`root`) and add/update `build.outDir`
(`build.outDir`) to point at `./${version}` so Tauri's frontendDist matches the
expected flattened output.
🧹 Nitpick comments (1)
v1/src/styles/tutorials.scss (1)
10-10: Nit: trailing whitespace on this blank line.Line 10 has trailing whitespace. Consider removing it.
|
@Nihal4777 @tachyons ready to review |

Fixes #922
Describe the changes you have made in this PR
This PR fixes the drag-and-drop functionality in v1 that was broken due to incorrect module loading. The root cause was that v0's main.ts file was being loaded instead of v1's main.ts, which meant the circuit element modules were never properly initialized before components tried to use them.

Changes made:
Screenshots of the UI changes (If any)
Before: Drag-and-drop not working, console errors when hovering/clicking circuit elements

After: Drag-and-drop working correctly

Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
Problem: When running v1 of the simulator, the drag-and-drop functionality for circuit elements was completely broken. The browser console showed errors like "modules[elementName] is not a constructor" and "Cannot read properties of undefined (reading 'prototype')".
Root Cause Analysis: Through debugging, I discovered that v0's main.ts file was being loaded instead of v1's main.ts (confirmed via import.meta.url showing
/simulatorvue/v1/v0/src/main.ts). This happened because Vite was resolving file paths from the project root, causing the path aliases (#/ and @/) to incorrectly point to v0's source files even when VITE_SIM_VERSION was set to "v1".Testing:
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.
Summary by CodeRabbit
Release Notes