Skip to content

Commit

Permalink
use registerChild to fix StrictMode on React 15+
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrews committed Jun 4, 2022
1 parent e114a3a commit e4e923b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
41 changes: 21 additions & 20 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"react-virtualized": "9.21.1",
"react-virtualized": "9.22.1",
"reconnecting-websocket": "^4.4.0",
"web-vitals": "^1.1.2",
"websocket": "^1.0.34"
Expand Down
8 changes: 5 additions & 3 deletions web/src/LogViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export default class LogViewer extends React.Component {

rowRenderer = ({ index, isScrolling, key, style, ...rest }) => (
<CellMeasurer {...rest} rowIndex={index} columnIndex={0} cache={this.cache}>
<div
{({registerChild}) => (
<div
ref={registerChild}
className="Row"
key={key}
style={{
Expand All @@ -94,7 +96,7 @@ export default class LogViewer extends React.Component {
}}
>
{this.state.lines[index]}
</div>
</div> )}
</CellMeasurer>

);
Expand All @@ -108,7 +110,7 @@ export default class LogViewer extends React.Component {
{({height}) => (
<List
// ref={this.setListRef}
ref={(list)=>{this.listRef = list}}
ref={ref => {this.listRef = ref}}
onScroll={this.handleScroll}
height={height}
rowCount={this.state.lines.length}
Expand Down

0 comments on commit e4e923b

Please sign in to comment.