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
Oh interesting. It doesn't recognize the Proxy as a Date object. I think it's likely I shouldn't be wrapping Dates in Proxies but you are correct, that it's not being bound to the right object.
I'm just trying to think where else this would apply. I do check if the value is a function on execution anyway so I could always bind functions but that seems perhaps incorrect to do in general.
I don't believe there are any downsides to not wrapping them. I'm not sure if change detection would work properly with mutating them. I think it's fair to treat them as immutable. I think Regex also probably fits into this category. Any opinions on how you'd expect them handled?
EDIT:
Seems MobX has hit this issue before: mobxjs/mobx#662
They treat Date as immutable. So I think I will follow suite.
EDIT 2:
It seems MobX avoids this whole category by not accepting any unknown object which isn't directly inherited from Object. It's clean in the sense it handles a bunch of weird edge cases. It does have bigger implications to consider. Also accessing the prototype has a noticeable performance cost. I think this is a place where a stance has to be taken. I'm taking this under consideration.
Hello, for some reason this simple code (I use your Counter example) throw error when I'm trying to use Date Object method from Solidjs state:
Console error:
Maybe the method call isn't bound to the correct object?
The text was updated successfully, but these errors were encountered: