You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all,
Unlike all other types of props, if you initialise an object property that has a defined default value with undefined, the default value is not used and the object is set to null.
... but properties only gets the default value if the value is not undefined:
(lines 551 Object.defineProperty.get)
if(typeofresult!=='undefined'){(...)returnresult}
We could easily fix this by changing that first null to undefined so that undefined objects keep their undefined value, although I don't know if that would have any side effects in other parts of the code.
Thanks !
Rui
The text was updated successfully, but these errors were encountered:
Hey @ruiramos. Clear fiddle. I agree, it does not produce naturally expected results.
This was a pretty early commit in the project that @HenrikJoreteg committed back in May last year. There are checks against null in the codebase which appear to be dependent on that null being set. Maybe you can test updating said checks and the blocks you pointed out, add test or two, and run the test suite?
Hey all,
Unlike all other types of props, if you initialise an object property that has a defined default value with
undefined
, the default value is not used and the object is set tonull
.Example: http://requirebin.com/?gist=dda59c50c9326e84064b
Not sure if this a bug or by design but it does feel a bit weird.
This happens because
undefined
objects are convertednull
in thedataTypes
object definition:(lines 645, object.set)
... but properties only gets the default value if the value is not
undefined
:(lines 551 Object.defineProperty.get)
We could easily fix this by changing that first null to undefined so that undefined objects keep their undefined value, although I don't know if that would have any side effects in other parts of the code.
Thanks !
Rui
The text was updated successfully, but these errors were encountered: