diff --git a/CHANGELOG.md b/CHANGELOG.md index 38051e2f..5ba07a5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## NEXT VERSION +- fix: `getTotalRowsHeight` could be different before/after render in dynamic mode on initial render + ## v1.10.6 (2020-07-25) - fix: `getTotalRowsHeight` could be different before/after render in dynamic mode diff --git a/src/BaseTable.js b/src/BaseTable.js index 09661977..0148d96d 100644 --- a/src/BaseTable.js +++ b/src/BaseTable.js @@ -125,6 +125,7 @@ class BaseTable extends React.PureComponent { this._rowHeightMapBuffer = {}; this._resetIndex = null; this.forceUpdateTable(); + this.forceUpdate(); this._isResetting = false; }, 0); @@ -742,14 +743,9 @@ class BaseTable extends React.PureComponent { this._maybeScrollbarPresenceChange(); if (estimatedRowHeight) { - // we have to wrap with setTimeout or we would still get the previous value, - // as we reset the inner components directly instead of update the table itself after row heights measured, - // so `componentDidUpdate` won't be invoked after that - setTimeout(() => { - if (this.getTotalRowsHeight() !== this._totalRowsHeight) { - this.forceUpdate(); - } - }); + if (this.getTotalRowsHeight() !== this._totalRowsHeight) { + this.forceUpdate(); + } } }