mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-04-30 15:28:02 +00:00
Prevent nodes out of viewport triggering render (#296)
* Prevent nodes out of viewport triggering render * Update frontend/src/common/SortedCollection.ts Co-authored-by: David <dvdplm@gmail.com> * Tweak the comment on `setFocus`, move it closer to `ref` and `hasChangedSince` * Switch `SortedCollection.ref()` to a getter Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
@@ -52,11 +52,11 @@ export class List extends React.Component<List.Props, {}> {
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { selectedColumns } = this.props.appState;
|
||||
const { pins, sortBy } = this.props;
|
||||
const { filter } = this.state;
|
||||
const { pins, sortBy, appState } = this.props;
|
||||
const { selectedColumns } = appState;
|
||||
const { filter, listStart, listEnd } = this.state;
|
||||
|
||||
let nodes = this.props.appState.nodes.sorted();
|
||||
let nodes = appState.nodes.sorted();
|
||||
|
||||
if (filter != null) {
|
||||
nodes = nodes.filter(filter);
|
||||
@@ -73,10 +73,13 @@ export class List extends React.Component<List.Props, {}> {
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
// With filter present, we can no longer guarantee that focus corresponds
|
||||
// to rendering view, so we put the whole list in focus
|
||||
appState.nodes.setFocus(0, nodes.length);
|
||||
} else {
|
||||
appState.nodes.setFocus(listStart, listEnd);
|
||||
}
|
||||
|
||||
const { listStart, listEnd } = this.state;
|
||||
|
||||
const height = TH_HEIGHT + nodes.length * TR_HEIGHT;
|
||||
const transform = `translateY(${listStart * TR_HEIGHT}px)`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user