Describe the bug
When you try to create a new property on an object during store update, and you set it to value undefined - a property descriptor is not added to the object, the in operator does not see it. The contradicts expected JS behavior:
import { createStore, produce } from "solid-js/store";
let normalObj = {} as any;
normalObj.foo = undefined;
// returns true
console.log("foo" in normalObj);
console.log(Object.getOwnPropertyDescriptors(normalObj));
let [val, setVal] = createStore({} as any);
setVal(
produce((x: any) => {
x.foo = undefined;
// returns false
console.log("foo" in x);
console.log(Object.getOwnPropertyDescriptors(x));
})
);
Playground with above code: https://playground.solidjs.com/anonymous/d71e1157-190b-4eca-94d1-cfab4e70c3c1
Your Example Website or App
https://playground.solidjs.com/anonymous/d71e1157-190b-4eca-94d1-cfab4e70c3c1
Steps to Reproduce the Bug or Issue
- Go to playground: https://playground.solidjs.com/anonymous/d71e1157-190b-4eca-94d1-cfab4e70c3c1
- Observe the console.
Expected behavior
A property descriptor should be created when a new property is assigned, even if assigned value is undefined.
Screenshots or Videos
No response
Platform
- OS: Windows 11
- Browser: Microsoft Edge
- Version: 108.0.1462.54 (Official build) (64-bit)
Additional context
No response