Immutable record not being revived correctly
turnerhayes opened this issue · comments
I'm encountering a bug when using redux-devtools-extension
that seems to come through this library; when I use the Persist
button in devtools and I have a record that I've passed with the refs
parameter (and was declared via class MyRecord extends Immutable.Record() {}
and is bundled by Webpack; it throws an error saying "Cannot call a class as a function". This seems to stem from this line, which just calls (theRightConstructor)(args)
rather than new (theRightConstructor)(args)
, which is an error for transpiled ES6 classes.
As a workaround I can presumably change the thing I pass to refs
to be (data) => new MyRecord(data)
rather than just MyRecord
, but that seems like it should be unnecessary.