Skip to content

Commit e550c8d

Browse files
committed
removed react autosizer
1 parent b7839eb commit e550c8d

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

arduino-ide-extension/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
"react-disable": "^0.1.0",
8080
"react-select": "^3.0.4",
8181
"react-tabs": "^3.1.2",
82-
"react-virtualized-auto-sizer": "^1.0.6",
8382
"react-window": "^1.8.6",
8483
"semver": "^7.3.2",
8584
"string-natural-compare": "^2.0.3",
@@ -92,7 +91,6 @@
9291
"@types/chai": "^4.2.7",
9392
"@types/chai-string": "^1.4.2",
9493
"@types/mocha": "^5.2.7",
95-
"@types/react-virtualized-auto-sizer": "^1.0.1",
9694
"@types/react-window": "^1.8.5",
9795
"chai": "^4.2.0",
9896
"chai-string": "^1.5.0",

arduino-ide-extension/src/browser/monitor/monitor-widget.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export class MonitorWidget extends ReactWidget {
191191
monitorModel={this.monitorModel}
192192
monitorConnection={this.monitorConnection}
193193
clearConsoleEvent={this.clearOutputEmitter.event}
194+
height={Math.floor(this.widgetHeight - 50)}
194195
/>
195196
</div>
196197
</div>

arduino-ide-extension/src/browser/monitor/serial-monitor-send-output.tsx

+21-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as React from 'react';
22
import { Event } from '@theia/core/lib/common/event';
33
import { 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';
65
import { MonitorModel } from './monitor-model';
76
import { MonitorConnection } from './monitor-connection';
87
import 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

132126
export 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

Comments
 (0)