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