chiefcll
chiefcll
SSolidJS
Created by chiefcll on 9/23/2024 in #support
createResource with a nested source signal doesn't retrigger
const [startTime, setStartTime] = createSignal(initialTime);
const [events, { refetch }] = createResource(
() => ({
service: channel,
startTime: startTime(),
duration: FOUR_HOUR_MILLISECONDS,
}),
epg.getEvents,
);
const [startTime, setStartTime] = createSignal(initialTime);
const [events, { refetch }] = createResource(
() => ({
service: channel,
startTime: startTime(),
duration: FOUR_HOUR_MILLISECONDS,
}),
epg.getEvents,
);
My source signal is an arrow function which returns an object that calls a signal for a value. When I setStartTime the epg.getEvents function is not called. Why is my startTime not being tracked properly?
7 replies
SSolidJS
Created by chiefcll on 8/13/2024 in #support
Solid Router - Lazy import section of site in one bundle / lazy add routes
I'm using the Solid Router and have sections of the site that are "First Time Users" or "Settings Pages" that are big pieces of the site but I'd like to lazy load them as one bundle. Is there a way to section off the Routes so const FTI = lazy(() => import("./pages/FTI")); <Route path="/fti" component={FTI}> FTI component could have many imports for other components and add to the router additional routes not defined in the index? Now that I'm asking this I think my question is can my index page have Router and then inside of a lazy loaded Page I can add additional Routes? Thanks.
5 replies
SSolidJS
Created by chiefcll on 9/5/2023 in #support
Solid Router with useParams, createResource and two params
I've got a dynamic page with two params in the url needed by createResource to make it's data call.
const params = useParams();

const [data] = createResource(params, provider.getInfo);
const params = useParams();

const [data] = createResource(params, provider.getInfo);
This works for the initial request, but if I navigate to same dynamic route with different params, it won't refetch the data. I assume this is due to params being a 'store' and doesn't trigger anything unless the properties are accessed. The following does work but isn't pretty:
const params = useParams();
// Need the reactivity and sending two params
function paramsWrapper() {
return {
id: params.id,
type: params.type
}
}

const [data] = createResource(paramsWrapper, provider.getInfo);
const params = useParams();
// Need the reactivity and sending two params
function paramsWrapper() {
return {
id: params.id,
type: params.type
}
}

const [data] = createResource(paramsWrapper, provider.getInfo);
I'd like to get rid of the paramsWrapper. Any way to turn params into a signal?
4 replies