-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BUG] Out of the box, cannot access lexical declaration 'root' before initialization #10
Comments
The code is correct // somewhere in your app and in solid-motionone
import {createSignal} from "solid-js"
if (!window.createSignal) {
window.createSignal = createSignal
} else {
console.log(window.createSignal === createSignal ? "Good" : "Bad")
} |
I've got the same issue. I confirmed both solid-motionone and the app are using the same version of solid-js using the method above. I'm working on a component library, and the code runs fine in my demo app, but fails in another app. I'll post if I figure something out. "solid-js": "1.9.1",
"solid-motionone": "1.0.2", |
Figured out our root issue. The app with the failure had some weird setup logic around the initial render that was causing this Solid warning to log: computations created outside a `createRoot` or `render` will never be disposed This stack overflow post helped explain it. Once I addressed the Solid warning, the above referenced issue went away. |
It might be nice to add a check in the code for |
I wouldn't mind having some nice error message that links to this issue during development |
Indeed, this was the problem I was programming a component library and using solid-motionone on my playground project as well as in the component library project. This caused two different versions of solidjs to be running.
This would be nice though, since I spent couple of hours trying to find the root cause of the problem. I totally understand this is not a solid-motionone issue but it would be a niceity plus. Maybe we could add the same check you advised me to use: function checkDupedSolid() {
if (!window._smoCheck ) {
window._smoCheck = createSignal
} else {
if (window._smoCheck !== createSignal) {
console.warn('There is more than one instance of solid running. This may cause errors in the use of this library.')
}
window._smoCheck = undefined;
}
}
checkDupedSolid();
Thanks! |
Hello!
I was trying to use this library in my SolidJS library project and I have found a problem. I tried to create a
<Motion.div>
element like this:When I try to visualize the component I get the following error:
Digging a little bit into solid-motionone I found that the conflicting line is inside the
MotionComponent
:solid-motionone/src/motion.tsx
Lines 35 to 45 in ba9005f
As it can be seen the
root
variable is declared after it's reference into the arrow function? For me the transpiled code appears as:I'm quite new to solid-js, sorry if I'm missing something obvious here. I also tried to but the
let root
before thecreateAndBindMotionState
call, and then the error isAnimation state must be mounted with valid Element
.Finally here's a little bit of info about versions:
Thanks in advance! 😁
The text was updated successfully, but these errors were encountered: