Skip to content

Commit 00b5cf6

Browse files
committed
fix: Terminal component should write initialContent before mounting
this may save a bit on refreshes in the UI
1 parent f86f0c5 commit 00b5cf6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugins/plugin-codeflare/src/components/Terminal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ export default class XTerm extends React.PureComponent<Props> {
3636
public componentDidMount() {
3737
this.mountTerminal()
3838

39-
if (this.props.initialContent) {
40-
// @starpit i don't know why we have to split the newlines...
41-
this.props.initialContent.split(/\n/).forEach(this.writeln)
42-
//this.terminal.write(this.props.initialContent)
43-
}
4439
if (this.props.on) {
4540
this.props.on("line", this.writeln)
4641
}
@@ -81,6 +76,12 @@ export default class XTerm extends React.PureComponent<Props> {
8176
Events.eventChannelUnsafe.on("/theme/change", inject)
8277
this.cleaners.push(() => Events.eventChannelUnsafe.on("/theme/change", inject))
8378

79+
if (this.props.initialContent) {
80+
// @starpit i don't know why we have to split the newlines...
81+
this.props.initialContent.split(/\n/).forEach(this.writeln)
82+
//this.terminal.write(this.props.initialContent)
83+
}
84+
8485
this.terminal.open(xtermContainer)
8586

8687
const doResize = () => {

0 commit comments

Comments
 (0)