Skip to content

Commit 6fb9f2e

Browse files
committed
Update Console.js
1 parent 6273133 commit 6fb9f2e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/app/Console.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import React from 'react';
2-
import { observer } from 'mobx-react';
1+
import React, { useRef, useEffect, useCallback } from 'react';
2+
import { observer } from 'mobx-react-lite';
33
import PropTypes from 'prop-types';
44
import Box from '@mui/material/Box';
55

6-
@observer
7-
class Console extends React.Component {
8-
keepToBottom = true;
6+
const Console = observer(({ run }) => {
7+
const stdoutContainerRef = useRef(null);
98

10-
onMountStdoutContainer = el => {
11-
this.stdoutContainer = el;
12-
};
139

1410
componentDidUpdate() {
1511
if (this.keepToBottom) {
@@ -30,7 +26,6 @@ class Console extends React.Component {
3026
this.stdoutContainer.scrollTop = diff;
3127
};
3228

33-
render() {
3429
const { run } = this.props;
3530
return (
3631
<Box
@@ -82,9 +77,9 @@ class Console extends React.Component {
8277
)}
8378
</div>
8479
</Box>
85-
);
86-
}
87-
}
80+
return (
81+
);
82+
});
8883

8984
Console.propTypes = {
9085
run: PropTypes.object.isRequired

0 commit comments

Comments
 (0)