RATIU5
Explore posts from serversHow do I run an effect every change except initialization?
I need to run an effect every subsequent change of a signal's value. I just need to skip the first initialization of the signal. I found this answer https://stackoverflow.com/a/78283918 and I implemented it, but it's not triggering on any updates.
5 replies
Solid.js does not render children in a `<For>` loop correctly
Take a look at my component code:
The
props.trashIcon
is only rendering once in this loop for the last item only. How can I get it to render for every element? I've tried everything I could think of like making it a safe child and wrapping it in functions and nothing has worked. Is this possible or a bug?28 replies
How can I skip the first effect run with createEffect?
I have a
createEffect
hook that runs when my signal does. Awesome. What I don't want, is for the effect to run when the initial signal value is set. I tried the following without success:
I don't get why this doesn't work since firstEffectHasRun
should be cached since it's used within the callback.5 replies
Reading localstorage theme value before rendering components not working
I'm setting up a theme toggle. It can successfully set the theme in localstorage. When loading a specific theme from storage, there is a brief "flash" of the default theme before converting to the desired theme.
Here is the function that loads the theme from localstorage. It's being loaded within the
<Head/>
tag from Solid Start.
The script always seems to run before the components but I'm not sure why I still get the flash. Is this a bug?12 replies
Small preload script after document load but before page load
I'm trying to port the theme toggle from tailwindcss.com to Solid.js. I'm getting stuck at this part. The following script:
needs to load after the base document loads in order to read localstorage but before the page elements load to prevent a theme change flash. (See the tailwind implementation https://github.com/tailwindlabs/tailwindcss.com/blob/master/src/pages/_document.js)
I tried adding a script inside the
Head
tags from Solid.js like this:
But it didn't work and I got no log in the console.
Could anyone point me to the direction to add a custom script at this point in the page render?5 replies