Signal set from localStorage not updating
I am setting a signal like:
I then pass the signal into context and use it another file in this function:
I then return it as is standard:
For some reason it does not update if the ternary is set to localStorage although it will update if I change
itemsCount()
to a signal that I set to itemsCount()
in onMount
or createEffect
if I use createRenderEffect
to set the signal, cart()
will have the desired value and itemsCount()
the desired return but it just does not update the DOM.
I know the server is setting the initial page load and I expect it to load as 0 but I would would expect there to be a way for me on the client to update the DOM before mount and avoid the flash to the updated value.
Any ideas if I can solve this or if solvable with source of data being localStorage?0 Replies