mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-10-20 18:56:21 +00:00
More performance tweaks
This commit is contained in:
1 parent
54039faa3b
commit
403b1c0fa1
3 files changed
+12
-15
No files matched your search
@@ -97,10 +97,12 @@ export class Connection {
|
|||||||
private pingSent: Maybe<Types.Timestamp> = null;
|
private pingSent: Maybe<Types.Timestamp> = null;
|
||||||
private resubscribeTo: Maybe<Types.ChainLabel> = getHashData().chain;
|
private resubscribeTo: Maybe<Types.ChainLabel> = getHashData().chain;
|
||||||
private resubscribeSendFinality: boolean = getHashData().tab === 'consensus';
|
private resubscribeSendFinality: boolean = getHashData().tab === 'consensus';
|
||||||
|
private updateThrottle = false;
|
||||||
private socket: WebSocket;
|
private socket: WebSocket;
|
||||||
private state: Readonly<State>;
|
private state: Readonly<State>;
|
||||||
private readonly update: Update;
|
private readonly update: Update;
|
||||||
private readonly pins: PersistentSet<Types.NodeName>;
|
private readonly pins: PersistentSet<Types.NodeName>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
socket: WebSocket,
|
socket: WebSocket,
|
||||||
update: Update,
|
update: Update,
|
||||||
@@ -408,8 +410,12 @@ export class Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.hasChangedSince(ref)) {
|
if (nodes.hasChangedSince(ref) && !this.updateThrottle) {
|
||||||
this.state = this.update({ nodes });
|
this.updateThrottle = true;
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
|
this.update({ nodes });
|
||||||
|
this.updateThrottle = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.autoSubscribe();
|
this.autoSubscribe();
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.List {
|
||||||
|
overflow-anchor: none;
|
||||||
|
}
|
||||||
|
|
||||||
.List-no-nodes {
|
.List-no-nodes {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
padding-top: 20vh;
|
padding-top: 20vh;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ export class List extends React.Component<List.Props, {}> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private relativeTop = -1;
|
private relativeTop = -1;
|
||||||
private scrolling = false;
|
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
this.onScroll();
|
this.onScroll();
|
||||||
@@ -108,10 +107,6 @@ export class List extends React.Component<List.Props, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onScroll = () => {
|
private onScroll = () => {
|
||||||
if (this.scrolling) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const relativeTop = divisibleBy(
|
const relativeTop = divisibleBy(
|
||||||
window.scrollY - (HEADER + TR_HEIGHT),
|
window.scrollY - (HEADER + TR_HEIGHT),
|
||||||
TR_HEIGHT * ROW_MARGIN
|
TR_HEIGHT * ROW_MARGIN
|
||||||
@@ -122,13 +117,7 @@ export class List extends React.Component<List.Props, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.relativeTop = relativeTop;
|
this.relativeTop = relativeTop;
|
||||||
this.scrolling = true;
|
|
||||||
|
|
||||||
window.requestAnimationFrame(this.onScrollRAF);
|
|
||||||
};
|
|
||||||
|
|
||||||
private onScrollRAF = () => {
|
|
||||||
const { relativeTop } = this;
|
|
||||||
const { viewportHeight } = this.state;
|
const { viewportHeight } = this.state;
|
||||||
const top = Math.max(relativeTop, 0);
|
const top = Math.max(relativeTop, 0);
|
||||||
const height =
|
const height =
|
||||||
@@ -139,8 +128,6 @@ export class List extends React.Component<List.Props, {}> {
|
|||||||
if (listStart !== this.state.listStart || listEnd !== this.state.listEnd) {
|
if (listStart !== this.state.listStart || listEnd !== this.state.listEnd) {
|
||||||
this.setState({ listStart, listEnd });
|
this.setState({ listStart, listEnd });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scrolling = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onResize = () => {
|
private onResize = () => {
|
||||||
|
|||||||
Reference in new issue
Block a user