Additions
- Now allows for automatic "unwrapping" of single cursors (and define what field to unwrap) #60. Example:
var localComponent = component.withDefaults({
cursorField: 'foobar'
});
var Component = localComponent(function(myPassedCursor) {
// Now you have myPassedCursor instead of having to do props.foobar
});
React.render(<Component foobar={myCursor} />, document.body)
- Added "hot swapping" of functions passed in statics. This is to swap out event handlers passed with a cursor reference. See #68
- As Omniscient encourages more work in the render function, you might have to do additional work even though some of your data is unchanged. We added
omniscient.cached
to allow for cached functions, dependent on input. Example:
var called = 0;
var point = function (point) {
return point.get('x') + ':' + point.get('y');
};
var line = component.cached(function (from, to) {
called = called + 1;
return point(from) + '-' + point(to)
});
var a = Cursor.from(Immutable.fromJS({x:0, y:0}));
var b = Cursor.from(Immutable.fromJS({x: 1, y:7}));
line(a, b).should.equal("0:0-1:7");
called.should.equal(1);
line(a, b).should.equal("0:0-1:7");
called.should.equal(1);
Bugfixes
- Fixes a bug where children were being attached as statics (#66)
- Fixes bug when overriding isEqualCursor (419046b)
- Fixes accessible cursor across mixins when unwrapping cursors. (#86)
Internal changes
- Now uses
lodash.assign
internally, for potential de-duping. #61
- Makes sure the
props
object is not mutated (#62)
- Uses isNode from React to test for valid elements (#63)
- Improves performance and simplifies internals of
shouldComponentUpdate
mixin (#78, #79)