SolidJSS
SolidJS11mo ago
Flemming

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...
   }
);


Above not working, below working.

createResource(
   () => deepCopy(onSaveSignal()),
   (sigObjValue) => {
     fetch...
   }
);

shallow structuredClone also fails.
Was this page helpful?