Closed corbt closed 8 years ago
If this looks good I'd appreciate a new release with this bugfix. :+1:
It looks good, could you add a failing testcase for this so we're covered against regression?
Then I'll get a release pushed out.
Well the failing you'd normally run into would be with the class MyRecord extends Record()
syntax, and we don't have ES6 in the tests... but I'll try to reverse the ES6 class
implementation and make a test that will have equivalent semantics.
function MyRecord(){}
MyRecord.prototype = Object.create(Record);
That should cover it I think.
Immutable.js confusingly allows for two syntaxes to create a new Record object:
MyRecord({ args })
andnew MyRecord({ args })
. However, only the latter syntax works when you've created a record by extending theRecord
class instead of just calling it (see docs).This PR uses the
new MyRecord
syntax, which is compatible with both ways of creating Records.Additionally, I rename
Record
toRecordConstructor
in the rehydration step to make it more clear that we're not dealing with Immutable'sRecord
at this point.