First time issue creator, long time fan of react-sweet-state.
I've noticed that if you return a Date from a selector then React components don't update.
After some digging I've found that when "update" runs it does a "shallowEqual" against previous and current values. Two different Dates are returning true with the custom shallowEqual function and therefore components never update. See screenshot for a test I wrote.
Workaround for now is to wrap the date in an object like selector: state => ({ date: state.myDate })
Perhaps we can just add another "if statement" for instanceof Date to shallowEqual?
Oh hi,
First time issue creator, long time fan of react-sweet-state.
I've noticed that if you return a Date from a selector then React components don't update. After some digging I've found that when "update" runs it does a "shallowEqual" against previous and current values. Two different Dates are returning true with the custom shallowEqual function and therefore components never update. See screenshot for a test I wrote.
Workaround for now is to wrap the date in an object like
selector: state => ({ date: state.myDate })
Perhaps we can just add another "if statement" for
instanceof Date
toshallowEqual
?Thanks!!