Closed djmccormick closed 8 years ago
I fixed it like so:
import Immutable from 'immutable';
import Domain from 'microcosm/domain';
export default class BaseDomain extends Domain { // Must extend.
getInitialState() {
return Immutable.Map();
}
commit(state) {
return state.toJS();
}
}
Huh. We implement safe defaults for those methods:
https://github.com/vigetlabs/microcosm/blob/master/src/domain.js
I wonder if Babel's loose mode class transpiler is doing something goofy. Before I go and blame other projects, I'll make sure we aren't doing anything silly, then I'll see if the output from the transpiler is problematic.
If a domain doesn't implement these functions, Microcosm (
10.0.0-rc3
) throws errors:setup
stage
shouldCommit
bundle.js:95234 Uncaught TypeError: domain.setup is not a function
coming out ofaddDomain
.