Skip to content

Commit faf456e

Browse files
author
Ives van Hoorne
committed
Make isScrolling a function for performance
1 parent 642d3ae commit faf456e

File tree

2 files changed

+5
-2
lines changed
  • packages/app/src/app/pages/Dashboard/Content

2 files changed

+5
-2
lines changed

packages/app/src/app/pages/Dashboard/Content/SandboxCard/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class SandboxItem extends React.PureComponent<Props> {
103103
if (
104104
this.el &&
105105
typeof this.el.focus === 'function' &&
106-
!this.props.isScrolling
106+
!this.props.isScrolling()
107107
) {
108108
this.el.focus();
109109
}

packages/app/src/app/pages/Dashboard/Content/SandboxGrid/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ class SandboxGrid extends React.Component<*, State> {
192192
});
193193
}
194194
};
195+
isScrolling = () => this.scrolling;
195196

196197
cellRenderer = ({ rowIndex, columnIndex, key, style, isScrolling }) => {
198+
this.scrolling = isScrolling;
199+
197200
let index = rowIndex * this.columnCount + columnIndex;
198201
const { sandboxes, signals } = this.props;
199202

@@ -238,7 +241,7 @@ class SandboxGrid extends React.Component<*, State> {
238241

239242
return (
240243
<SandboxItem
241-
isScrolling={isScrolling}
244+
isScrolling={this.isScrolling}
242245
id={item.id}
243246
title={item.title || item.id}
244247
details={editedSince}

0 commit comments

Comments
 (0)