mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-12 01:26:23 +02:00
change componentWillUpdate to componentDidUpdate
This commit is contained in:
@ -24,14 +24,15 @@ class LogRow extends Component {
|
||||
}
|
||||
|
||||
export class Console extends PureComponent {
|
||||
componentWillUpdate(nextProps) {
|
||||
if (nextProps.logs != this.props.logs) {
|
||||
componentDidUpdate(previousProps) {
|
||||
if (this.props.logs !== previousProps.logs) {
|
||||
// Scroll down after new log dom is inserted
|
||||
setTimeout(() => {
|
||||
this.logContainerEl.scrollTop = this.logContainerEl.scrollHeight;
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
logs,
|
||||
@ -79,7 +80,9 @@ export class Console extends PureComponent {
|
||||
this.logContainerEl = el;
|
||||
}}
|
||||
>
|
||||
{logs.map(log => <LogRow data={log} />)}
|
||||
{logs.map(log => (
|
||||
<LogRow data={log} />
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div
|
||||
|
@ -72,6 +72,8 @@ export default class ContentWrapFiles extends Component {
|
||||
);
|
||||
}
|
||||
componentWillUpdate(nextProps) {
|
||||
// TODO: REMOVE AS THIS LIFECYCLE HOOK IS DEPRECATED
|
||||
|
||||
// If we get a new Item, clear file buffers and currently selected file.
|
||||
if (
|
||||
this.props.currentItem.createdOn !== nextProps.currentItem.createdOn ||
|
||||
|
Reference in New Issue
Block a user