mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix batchedUpdates return value (#7444)
This commit is contained in:
@@ -60,9 +60,9 @@ var ReactDefaultBatchingStrategy = {
|
||||
|
||||
// The code is written this way to avoid extra allocations
|
||||
if (alreadyBatchingUpdates) {
|
||||
callback(a, b, c, d, e);
|
||||
return callback(a, b, c, d, e);
|
||||
} else {
|
||||
transaction.perform(callback, null, a, b, c, d, e);
|
||||
return transaction.perform(callback, null, a, b, c, d, e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
||||
|
||||
function batchedUpdates(callback, a, b, c, d, e) {
|
||||
ensureInjected();
|
||||
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
||||
return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1147,4 +1147,10 @@ describe('ReactUpdates', function() {
|
||||
ReactDOM.render(<App />, document.createElement('div'));
|
||||
});
|
||||
|
||||
it('unstable_batchedUpdates should return value from a callback', function() {
|
||||
var result = ReactDOM.unstable_batchedUpdates(function() {
|
||||
return 42;
|
||||
});
|
||||
expect(result).toEqual(42);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user