11import * as React from 'react' ;
22import { Event } from '@theia/core/lib/common/event' ;
33import { DisposableCollection } from '@theia/core/lib/common/disposable' ;
4- import { FixedSizeList as List } from 'react-window' ;
5- import AutoSizer from 'react-virtualized-auto-sizer' ;
4+ import { areEqual , FixedSizeList as List } from 'react-window' ;
65import { MonitorModel } from './monitor-model' ;
76import { MonitorConnection } from './monitor-connection' ;
87import dateFormat = require( 'dateformat' ) ;
@@ -32,29 +31,23 @@ export class SerialMonitorOutput extends React.Component<
3231
3332 render ( ) : React . ReactNode {
3433 return (
35- < div style = { { height : '100%' } } >
36- < AutoSizer >
37- { ( { height, width } ) => (
38- < List
39- className = "serial-monitor-messages"
40- height = { height }
41- itemData = {
42- {
43- lines : this . state . lines ,
44- timestamp : this . state . timestamp ,
45- } as any
46- }
47- itemCount = { this . state . lines . length }
48- itemSize = { 20 }
49- width = { width }
50- ref = { this . listRef }
51- onItemsRendered = { this . scrollToBottom }
52- >
53- { Row }
54- </ List >
55- ) }
56- </ AutoSizer >
57- </ div >
34+ < List
35+ className = "serial-monitor-messages"
36+ height = { this . props . height }
37+ itemData = {
38+ {
39+ lines : this . state . lines ,
40+ timestamp : this . state . timestamp ,
41+ } as any
42+ }
43+ itemCount = { this . state . lines . length }
44+ itemSize = { 18 }
45+ width = { '100%' }
46+ ref = { this . listRef }
47+ onItemsRendered = { this . scrollToBottom }
48+ >
49+ { Row }
50+ </ List >
5851 ) ;
5952 }
6053
@@ -105,7 +98,7 @@ export class SerialMonitorOutput extends React.Component<
10598 } ) . bind ( this ) ;
10699}
107100
108- const Row = ( {
101+ const _Row = ( {
109102 index,
110103 style,
111104 data,
@@ -128,12 +121,14 @@ const Row = ({
128121 null
129122 ) ;
130123} ;
124+ const Row = React . memo ( _Row , areEqual ) ;
131125
132126export namespace SerialMonitorOutput {
133127 export interface Props {
134128 readonly monitorModel : MonitorModel ;
135129 readonly monitorConnection : MonitorConnection ;
136130 readonly clearConsoleEvent : Event < void > ;
131+ readonly height : number ;
137132 }
138133
139134 export interface State {
0 commit comments