-
Notifications
You must be signed in to change notification settings - Fork 132
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
element.ownerDocument.documentElement is null onMount in linked package #378
Comments
That's correct @bigmistqke. It's only an issue when linking. |
@ralphsmith80 do you have reproduction steps with the repo mentioned above, I did all the install and npm link dance but I couldnt get it to work |
@bigmistqke wrote me in discord and helped me to reproduce, I will be investigating this, thanks!
|
Perfect. I was going to clone it and test it myself since I didn't put this repo together for the issue. Figured it was a diff between npm and pnpm. |
@ralphsmith80 the issue is that the build includes two versions of solid. If you set Looking into I have started this thread in solidjs discord asking if anyone knows how to fix this |
Seems like app is using solid-js from It has been commented in the linked thread that a "pnpm workspace" can be used to deal with this issue https://pnpm.io/workspaces |
@titoBouzout, @bigmistqke was providing me a bunch of support when I was building a couple of libraries for solidjs, but if the issue you are seeing is two version of solidjs then I don't think the minimum example is capturing the issue. In my own case I'm using the workspace linking and I don't see the multiple version issue, which I was seeing on the first library I was fixing so I am familiar with that occurring and I resolved it in my own cases. Actually, you can see the issue in the solid-js wrapper for plotly.js at solid-plotly.js. It's a small repo so pretty minimal in itself. It's a pnpm monorepo. It has a To test this there is an apps/demo application that uses a pnpm workspace link to link to the solid-plotly.js package here. This app renders a few different solid-plotly.js charts to test different configs, but you can comment them all out except for one so see the difference between running the built version and the dev version. To see the issue you need to comment out that single tick await I pointed out above. Just make sure you rebuild the package so the change is picked up in the demo app. |
Ok, but can you please provide a step-by-step instruction into how to reach a page opened in the browser that leads to such an issue being shown |
@titoBouzout it's just a single page |
ok, I will try it when I make a bit of time, just that I do not use vite nor pnpm, so I have problems to reproduce what you expect, if you can guide me with some commands and "edit this line on this file after you install X" that would be very helpful |
Bah! You won't be able to reproduce it with the monorepo for the reasons you noted above. It is a pnpm monorepo. It's only an issue if you link to it from another repro that's not part of the mono repo. I'm sure that why @bigmistqke provided the minimum repo example with linking the way he did. I just tested the repo provide by @bigmistqke myself and I think your use of I say that because you're using it when producing a production build (NODE_ENV=development pnpm build) which is incorrect. You can pass that when running the dev server |
@ralphsmith80 I am with you. I said I do not use vite or pnpm personally, but I am willing to use any of both, and even change my environment variables to be able to reproduce your issue. So if you can, please, can you give a list of commands, that I can follow (even if that involves editing npm packages at a file/line or whatever) that are reproducible of the problem you are seeing? That would be helpful, that's all I am saying. I have run the reported "issue" and my conclusion is that there are 2 versions of solid running at the same time. (regardless of my configuration) So, if you think I am mistaken (which is very likely), can you please provide me a list of procedures that I can follow to reproduce the issue. Thanks! |
@titoBouzout, here's a repository that creates the error. https://github.com/ralphsmith80/solid-link-issue
When I run |
Thanks, I will check it out later today |
I suspect that if you read the generated js file you will find out that solid functions are duplicated, but we will see |
If you use a Mac you can repro with the following command |
For clarification |
Right, I just used pnpm link, but manually updated the package.json and it missed that. If that's the issue so be it. I only used linking like this because I was trying to test the library more thoroughly before publishing it. Not because that's how I would build the production app that uses the library. In the end I published it and just crossed my fingers which worked. Since it worked in the context of a mono-repo using linking, but no outside the context of a monorepo I didn't catch why there would be a difference, but if there are in fact two instances of solid.js in that case then it makes sense why that would happen. |
With the following snippet:
We get different results in between dev and build when linking the package into a solid app:
element.ownerDocument.documentElement
is defined in dev mode, but isnull
when build.When delaying it by a frame with
requestAnimationFrame
we do get the expected result:When inlining it directly in the app, it also does not give an error, so it's a quite surprising bug. Afaik the bug also does not seem to show up when downloading the published library, only during linking (am i correct in this, @ralphsmith80 ?)
a minimal reproduction of the bug
This bug came apparent during development of solid-plotly.js as
plotly-js
apparently makes use of this during initialisation.The text was updated successfully, but these errors were encountered: