-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[fix] ensure style manager instances don't conflict with each other #7114
Conversation
I don't think this works. If two independent instances have the same root (the document), they would still interfere. |
@dummdidumm each Svelte instance would create it's own stylesheet and it only manages stylesheets that are created within that instance. |
Oh right, got confused here, the map is not shared 👍 |
I first was also confused why ther is a Maybe |
Good find. I suggest to document this so this is more clear for future readers (including me 😄 )
👍 |
I just saw that the |
The hash function in that file is a little larger and it's part of the compiler, not the runtime, so I wouldn't worry about that for now, although I'm not sure if this is just an oversight or a deliberate decision. |
Looks good.. I hope this gets into the |
i wonder if it is possible to have a test case for this? |
I will take a look at how to test multiple svelte applications running in parallel. And also a test for the iframe thing should be added. I can try both cases in the next couple of days. |
Yeah that is a tough one as this is a timing / visual glitch. The symptom of when it doesn't work is when two runtimes that have active transitions where the first to finish clears out the style rules of all other runtimes. That may be hard to set up a full test say in puppeteer; I honestly haven't looked at the testing infrastructure deeply, but it looks like puppeteer is involved. A "synthetic test" could be simulating the call order into This is definitely in the hard to test / edge case territory. I did test your PR with my actual runtime environment w/ multiple independently compiled apps to make sure it works. Given that this may become a more common usage pattern on "platform" like efforts any issues would be raised fairly quickly. |
I just saw that there is already a test for the iframe stuff: The svelte internals where the |
We discussed and agreed a test should not block this given the difficulty |
fixes animations with multiple independent Svelte apps running at the same time.
This is an alternative approach to #7107.
Closes #7107
Fixes #7026
Instead of storing the style information directly on the
node
via a random property name, here the information get's stored inside a locale varable within thestyle_manager
.