solid icon indicating copy to clipboard operation
solid copied to clipboard

Method of disabling multiple instances warning

Open benmccann opened this issue 2 months ago • 2 comments

I'm getting the warning:

You appear to have multiple instances of Solid. This can lead to unexpected behavior.

I don't think there's actually any issue in my case. The two instances/components don't share any common root and I don't want them to interact in any way. Also, one of the instances is present only in development, so I'm not worried about extra bytes being shipped to production because of an extra copy.

I would love if there were some way to disable this warning since I don't think it's actually a problem in my case.

benmccann avatar Oct 22 '25 20:10 benmccann

Hmm.. Yeah majority time this happens because someone packages a version of Solid with a library and then we get things not reacting. This happened enough times that we added the warning.

But if completely isolated, I suppose there wouldn't be any collisions. Disabling it is interesting though since it is basically a global check on import, so there is no configuration that happens before it. I wonder if we can bypass the check by setting a global before import. Seems hacky but I'm not sure how else to bypass it in time. Or what other sort of check we could do that would accomplish the same.

ryansolid avatar Oct 23 '25 00:10 ryansolid

I'm really struggling with this one because I'm trying to think of a way to do this so that some 3rd party tool doesn't just turn off the check for everyone. It's one thing to say hey my thing doesn't care, but if say this is like used in some devtools and it turns off the check then people won't realize when a different library has this issue.

We need to think of something else in terms of the check. A unique symbol per module that gets set/checked in the render call optionally might be an option. But that comes from solid-js/web not core so in a sense doesn't guarantee what we need. But maybe something else along this vein?..

ryansolid avatar Oct 27 '25 21:10 ryansolid