Joshua
Joshua
SSolidJS
Created by Joshua on 2/21/2025 in #support
solid-router causes error: "cleanups created outside a `createRoot` or `render` will never be run"
15 replies
SSolidJS
Created by Joshua on 2/21/2025 in #support
solid-router causes error: "cleanups created outside a `createRoot` or `render` will never be run"
@peerreynders First of all I really want toto thank you for the detailed answer and explanations that is very helpful! Exactly I was trying to do the basic example for react supabase auth with solid. I know react quite well and there I could write a Celan up function in an effect. But I now understand that in solid I cannot do that because of reactive context gets breaken when using async. Is there a page in the docs or a good yt video or something that explains the reactive context? I understand signals and reactivity but the reactive context specific to solid I think I need to read up on. I fixed it by ensuring the cleanup is created before reactive context is gone because of await and now the error is gone see my new MainLayout.tsx But I still have below error for a different part of the code, and before I added the router I did not have this issue: createLocalStorageStore.tsx:21 computations created outside a createRoot or render will never be disposed I have this custom hook createLlocalStorageStore, and before I added the router it worked fine. Now it still works but I get this, why? I know I probably also could somehow solve this with a context, but since it is a single hook and I know it will always only be used in one component, I read that you can just create a store outside a component in a file ts without having to use a context etc that this is fine in solidjs. But why does the warning now show up after adding the router or how would I fix the warning? The relevant files () are attached. Also ofc you are right that normally such code would go into a context but since I will put the login as the main page and use a redirect and not need to have access in my whole app to the user I decided to to it simple as POC directly without context, since with supabase you can get the user anyway anywhere in the app via supabase.auth.getSession() but ofc course if it grows etc then a context would make sense so thanks for the guidance.
15 replies