We had a bug on our site that we were having a hell of a time troubleshooting, because all of the error logs stated that it was coming from inside a date picker, and that our date picker was trying to call .getTime() on what should have been a date object, but was somehow a string. It took a LOT of effort to determine that when we passed in an object to track to people.set, that mixpanel traversed the object recursively and changed any Date objects to date strings, then the next time react re-rendered, it was passing the same object with the dates mutated to strings to the date picker, which was expecting a Date object, causing it to crash our site.
We resolved this issue a few ways in our project, but I made this ticket because mixpanel should not be mutating the objects that are passed in for tracking purposes. a deep clone should be created if changes need to be made to the object to track it succesfully.
We had a bug on our site that we were having a hell of a time troubleshooting, because all of the error logs stated that it was coming from inside a date picker, and that our date picker was trying to call
.getTime()on what should have been a date object, but was somehow a string. It took a LOT of effort to determine that when we passed in an object to track to people.set, that mixpanel traversed the object recursively and changed any Date objects to date strings, then the next time react re-rendered, it was passing the same object with the dates mutated to strings to the date picker, which was expecting a Date object, causing it to crash our site.We resolved this issue a few ways in our project, but I made this ticket because mixpanel should not be mutating the objects that are passed in for tracking purposes. a deep clone should be created if changes need to be made to the object to track it succesfully.