Flemming
Flemming
SSolidJS
Created by Flemming on 2/6/2025 in #support
createSignal equals: false on mutable object value
Hi guys, I have a resource source signal with { equals: false } that does not trigger fetching unless I wrap and deep copy the object literal value in the source param. The value itself is a propety of an instance wrapped with createMutable, which I suspect is at the crux of this. But why? I though equals: true would guarantee a truthy source signal on setting?
const muatable = createMutable(myClassInstance)
[...]
const [onSaveSignal, setSaveSignal] = createSignal(mutable.data, { equals: false })
[...]
createResource(
onSaveSignal,
(sigObjValue) => {
fetch...
}
);
const muatable = createMutable(myClassInstance)
[...]
const [onSaveSignal, setSaveSignal] = createSignal(mutable.data, { equals: false })
[...]
createResource(
onSaveSignal,
(sigObjValue) => {
fetch...
}
);
Above not working, below working.
createResource(
() => deepCopy(onSaveSignal()),
(sigObjValue) => {
fetch...
}
);
createResource(
() => deepCopy(onSaveSignal()),
(sigObjValue) => {
fetch...
}
);
shallow structuredClone also fails.
29 replies
SSolidJS
Created by Flemming on 3/2/2023 in #support
Suspense triggered witout reading data
So... trying to wrap my head around suspense. This is based off the "Real word" Solid example: I have a service with a store which is populated through actions on singin/signup. I have Login-component with a resource for each of them, signin/up + load data. The login component doesn't use any of those resources' data itself, but it still "owns" the loading spinner, so Suspense seems a natural candidate. What would be a idiomatic way to solve/structure this? My cleanest workaround so far is to include a call to a suspense-trigger in the JSX. The trigger is just this:
const suspenseTrigger = () => {
signupData();
signinData();
userData();
return '';
};
const suspenseTrigger = () => {
signupData();
signinData();
userData();
return '';
};
...but I am not happy with it as it tells me I should be doing stuff differently. Thanks.
9 replies