Search params reactivity in route's data loader function
I've got a problem with search params in route's data function. Basically I've got something like in the screenshot and whenever search param changes, effect is not run, so input value isn't changing.
Do you guys know how can I make this work?
SOLUTION: spreading search doesn't lose reactivity, so I've just spread search const and everything works as intended.
9 Replies
I'm using
useRoutes
from @solidjs/router
The problem here is that search is a bit like a store in solid, meaning you have to access a property to get a reactive value
Here you go:
Not sure what you are trying to accomplish with
type: params.type
thoughThanks for the replies guys, @carlonyte search is not an accessor, so it's not callable
@apollo79 seems like that's the case, but the problem is that, that search object can get quite big, there's no way to make it reactive somehow? I will have many properties there, basically I'm using it as a filter for some data.
Well, one way would be accessing one property that you know it exists always
I think destructurung
search
should work too as that accesses all properties (?)Oh man. Yup Iβm an idiot. Donβt know what I was thinking π
for now I did something like this π
heh, destructuring works, I was certain that I would lose reactivity, but seems like this is not the case
thanks a lot
Np π