react-virtualized
Advanced tools
Comparing version 9.7.2 to 9.7.3
Changelog | ||
------------ | ||
##### 9.7.3 | ||
* Clear cell and style cache when controlled-scroll mode `Grid` stops scrolling. ([@leoasis](https://github.com/leoasis) - [#649](https://github.com/bvaughn/react-virtualized/pull/649)) | ||
##### 9.7.2 | ||
@@ -5,0 +8,0 @@ * ✨ Removed lingering `React.PropTypes` reference in `InfiniteLoader`. |
@@ -524,2 +524,7 @@ 'use strict'; | ||
// If scrolling is controlled outside this component, clear cache when scrolling stops | ||
if (nextProps.autoHeight && nextProps.isScrolling === false && this.props.isScrolling === true) { | ||
this._resetStyleCache(); | ||
} | ||
// Update scroll offsets if the size or number of cells have changed, invalidating the previous value | ||
@@ -767,23 +772,3 @@ (0, _calculateSizeAndPositionDataAndUpdateScrollOffset2.default)({ | ||
this._disablePointerEventsTimeoutId = null; | ||
var styleCache = this._styleCache; | ||
// Reset cell and style caches once scrolling stops. | ||
// This makes Grid simpler to use (since cells commonly change). | ||
// And it keeps the caches from growing too large. | ||
// Performance is most sensitive when a user is scrolling. | ||
this._cellCache = {}; | ||
this._styleCache = {}; | ||
// Copy over the visible cell styles so avoid unnecessary re-render. | ||
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) { | ||
for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) { | ||
var key = rowIndex + '-' + columnIndex; | ||
this._styleCache[key] = styleCache[key]; | ||
} | ||
} | ||
this.setState({ | ||
isScrolling: false | ||
}); | ||
this._resetStyleCache(); | ||
} | ||
@@ -993,2 +978,26 @@ }, { | ||
}, { | ||
key: '_resetStyleCache', | ||
value: function _resetStyleCache() { | ||
var styleCache = this._styleCache; | ||
// Reset cell and style caches once scrolling stops. | ||
// This makes Grid simpler to use (since cells commonly change). | ||
// And it keeps the caches from growing too large. | ||
// Performance is most sensitive when a user is scrolling. | ||
this._cellCache = {}; | ||
this._styleCache = {}; | ||
// Copy over the visible cell styles so avoid unnecessary re-render. | ||
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) { | ||
for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) { | ||
var key = rowIndex + '-' + columnIndex; | ||
this._styleCache[key] = styleCache[key]; | ||
} | ||
} | ||
this.setState({ | ||
isScrolling: false | ||
}); | ||
} | ||
}, { | ||
key: '_updateScrollTopForScrollToRow', | ||
@@ -995,0 +1004,0 @@ value: function _updateScrollTopForScrollToRow() { |
@@ -482,2 +482,7 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
// If scrolling is controlled outside this component, clear cache when scrolling stops | ||
if (nextProps.autoHeight && nextProps.isScrolling === false && this.props.isScrolling === true) { | ||
this._resetStyleCache(); | ||
} | ||
// Update scroll offsets if the size or number of cells have changed, invalidating the previous value | ||
@@ -725,23 +730,3 @@ calculateSizeAndPositionDataAndUpdateScrollOffset({ | ||
this._disablePointerEventsTimeoutId = null; | ||
var styleCache = this._styleCache; | ||
// Reset cell and style caches once scrolling stops. | ||
// This makes Grid simpler to use (since cells commonly change). | ||
// And it keeps the caches from growing too large. | ||
// Performance is most sensitive when a user is scrolling. | ||
this._cellCache = {}; | ||
this._styleCache = {}; | ||
// Copy over the visible cell styles so avoid unnecessary re-render. | ||
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) { | ||
for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) { | ||
var key = rowIndex + '-' + columnIndex; | ||
this._styleCache[key] = styleCache[key]; | ||
} | ||
} | ||
this.setState({ | ||
isScrolling: false | ||
}); | ||
this._resetStyleCache(); | ||
} | ||
@@ -951,2 +936,26 @@ }, { | ||
}, { | ||
key: '_resetStyleCache', | ||
value: function _resetStyleCache() { | ||
var styleCache = this._styleCache; | ||
// Reset cell and style caches once scrolling stops. | ||
// This makes Grid simpler to use (since cells commonly change). | ||
// And it keeps the caches from growing too large. | ||
// Performance is most sensitive when a user is scrolling. | ||
this._cellCache = {}; | ||
this._styleCache = {}; | ||
// Copy over the visible cell styles so avoid unnecessary re-render. | ||
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) { | ||
for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) { | ||
var key = rowIndex + '-' + columnIndex; | ||
this._styleCache[key] = styleCache[key]; | ||
} | ||
} | ||
this.setState({ | ||
isScrolling: false | ||
}); | ||
} | ||
}, { | ||
key: '_updateScrollTopForScrollToRow', | ||
@@ -953,0 +962,0 @@ value: function _updateScrollTopForScrollToRow() { |
@@ -6,3 +6,3 @@ { | ||
"user": "bvaughn", | ||
"version": "9.7.2", | ||
"version": "9.7.3", | ||
"homepage": "https://github.com/bvaughn/react-virtualized", | ||
@@ -34,3 +34,3 @@ "main": "dist/commonjs/index.js", | ||
"test": "npm run lint && npm run test:jest", | ||
"test:jest": "jest --no-watchman", | ||
"test:jest": "jest --no-watchman --runInBand", | ||
"watch": "watch 'clear && npm run test -s' source", | ||
@@ -37,0 +37,0 @@ "watch:jest": "jest --no-watchman --watch" |
@@ -191,2 +191,3 @@ [<img src="https://cloud.githubusercontent.com/assets/29597/11737732/0ca1e55e-9f91-11e5-97f3-098f2f8ed866.png" alt="React virtualized" data-canonical-src="https://cloud.githubusercontent.com/assets/29597/11737732/0ca1e55e-9f91-11e5-97f3-098f2f8ed866.png" width="330" height="100" />](http://bvaughn.github.io/react-virtualized/) | ||
* [List](https://bvaughn.github.io/react-virtualized/#/components/List) | ||
* [Masonry](https://bvaughn.github.io/react-virtualized/#/components/Masonry) | ||
* [MultiGrid](https://bvaughn.github.io/react-virtualized/#/components/MultiGrid) | ||
@@ -193,0 +194,0 @@ * [ScrollSync](https://bvaughn.github.io/react-virtualized/#/components/ScrollSync) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2657270
37861
234