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
Lightswitch not applying persistent state to html #2598
Comments
Worth to note; Manually including
in //EDIT: Scratch that, it's non-deterministic - sometimes it works sometimes it doesnt. //EDIT2: Placing Seems like a race-condition somewhere? |
@f0o can you share a few more details about your project config. Specifically:
For example, under normal circumstances when using the default auto-adapter you should not need to insert the extra script tag in the page header. We also provide this note when using the Lightswitch with the class-based strategy approach:
So if the ilghtswitch is not part of the normal DOM tree on page load, then it can cause behavior similar to what you're reporting. For the Skeleton documentation site for example, this is part of the header. Even though it is "hidden" within a popup menu, but that menu is just visibly hidden, not removed from the DOM. |
I can't speak for f0o but I'm experiencing the same issue. I'm using the I've copied the AppBar code straight from the Skeleton site so the LightSwitch should be in the DOM. I can see the |
I've had success removing the |
I've entirely forgotten about this bugreport; terribly sorry about it. I'm also using adapter-static but without SSR and the class selector. That being said; I've been running it with my OnMount workaround since I opened the bugreport and although hacky it seems to be stable across all browsers. |
Current Behavior
After Toggling Lightswitch and reloading the page, the page will return to the default state instead of the one selected by Lightswitch.
The code https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/LightSwitch/LightSwitch.svelte#L77 seems to be the culprit.
Copy-pasting the code itself into the JS Console will set the correct state into HTML but that oddly formed "fake" script tag will not trigger execution (at least on current Google Chrome).
Expected Behavior
https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/LightSwitch/LightSwitch.svelte#L77
Should execute correctly and set the class into html element
Steps To Reproduce
Link to Reproduction / Stackblitz
No response
More Information
Google Chrome: Version 123.0.6312.106 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: