lxsmnsyc / solid-styled

Reactive stylesheets for SolidJS
MIT License
177 stars 11 forks source link

solid-styled doesn't work with routing #12

Closed orenelbaum closed 1 year ago

orenelbaum commented 1 year ago

I modified the demo example to be as minimal as possible but include routing. If I have the css function in one of the routes, when I switch to a new route I get this error

index.mjs:1 Uncaught (in promise) DOMException: Failed to execute 'querySelector' on 'Element': 'style[s:id="example-Home-32ae95df-0-1"]' is not a valid selector.
    at Object.f [as remove] (http://127.0.0.1:5173/node_modules/.vite/deps/solid-styled.js?v=cf718557:37:27)
    at Array.<anonymous> (http://127.0.0.1:5173/node_modules/.vite/deps/solid-styled.js?v=cf718557:54:37)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1028:23)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1023:7)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1023:7)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1023:7)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1023:7)
    at cleanNode (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:1023:7)
    at updateComputation (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:733:3)
    at runTop (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-MTPIYOZY.js?v=26f61b75:844:7)
f @ index.mjs:1
(anonymous) @ index.mjs:1
cleanNode @ dev.js:921
cleanNode @ dev.js:917
cleanNode @ dev.js:917
cleanNode @ dev.js:917
cleanNode @ dev.js:917
cleanNode @ dev.js:917
updateComputation @ dev.js:672
runTop @ dev.js:770
runQueue @ dev.js:840
completeUpdates @ dev.js:796
runUpdates @ dev.js:787
(anonymous) @ dev.js:499
Promise.then (async)
(anonymous) @ routing.js?v=26f61b75:268
untrack @ dev.js:421
navigateFromRoute @ routing.js?v=26f61b75:228
handleAnchorClick @ routing.js?v=26f61b75:338

Here's the minimal reproduction I made https://github.com/orenelbaum/solid-styled-routing-bug

The same also holds for the Solid Start template, see https://github.com/solidjs/solid-start/issues/508

lxsmnsyc commented 1 year ago

This has been fixed at #11, but I haven't made a patch release yet. I'll probably include it in the minor release (I'll be pushing some other agenda later on)

lxsmnsyc commented 1 year ago

Should be fixed in 0.7.4