Skip to content

Commit 7cc37cc

Browse files
authored
fix: getTotalRowsHeight could be different before/after render in dynamic mode again (#204)
1 parent 7e6e194 commit 7cc37cc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## NEXT VERSION
44

5+
- fix: `getTotalRowsHeight` could be different before/after render in dynamic mode on initial render
6+
57
## v1.10.6 (2020-07-25)
68

79
- fix: `getTotalRowsHeight` could be different before/after render in dynamic mode

src/BaseTable.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class BaseTable extends React.PureComponent {
125125
this._rowHeightMapBuffer = {};
126126
this._resetIndex = null;
127127
this.forceUpdateTable();
128+
this.forceUpdate();
128129
this._isResetting = false;
129130
}, 0);
130131

@@ -742,14 +743,9 @@ class BaseTable extends React.PureComponent {
742743
this._maybeScrollbarPresenceChange();
743744

744745
if (estimatedRowHeight) {
745-
// we have to wrap with setTimeout or we would still get the previous value,
746-
// as we reset the inner components directly instead of update the table itself after row heights measured,
747-
// so `componentDidUpdate` won't be invoked after that
748-
setTimeout(() => {
749-
if (this.getTotalRowsHeight() !== this._totalRowsHeight) {
750-
this.forceUpdate();
751-
}
752-
});
746+
if (this.getTotalRowsHeight() !== this._totalRowsHeight) {
747+
this.forceUpdate();
748+
}
753749
}
754750
}
755751

0 commit comments

Comments
 (0)