fix: correct module instead of react

This commit is contained in:
Hongarc 2019-04-25 10:02:00 +07:00
parent 64eb8ab773
commit 208a6c843a
5 changed files with 17 additions and 18 deletions

View file

@ -13,7 +13,7 @@ var _subscribeEvents = [
class CommandHistoryView extends React.Component {
componentDidMount() {
componentDidMount() {
for (var i = 0; i < _subscribeEvents.length; i++) {
this.props.commandCollection.on(
_subscribeEvents[i],
@ -24,7 +24,7 @@ class CommandHistoryView extends React.Component {
this.props.commandCollection.on('change', this.scrollDown, this);
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
Main.getEvents().on('clearOldCommands', this.clearOldCommands, this);
Main.getEvents().on('clearOldCommands', () => this.clearOldCommands(), this);
}
componentWillUnmount() {

View file

@ -1,8 +1,9 @@
var React = require('react');
var ReactDOM = require('react-dom');
var PropTypes = require('prop-types');
var reactUtil = require('../util/reactUtil');
var keyMirror = require('react/lib/keyMirror');
var keyMirror = require('fbjs/lib/keyMirror');
var STATUSES = keyMirror({
inqueue: null,
@ -24,16 +25,7 @@ class CommandView extends React.Component{
}
onModelDestroy() {
if (!this.isMounted()) {
return;
}
if (!this.getDOMNode) {
// WTF -- only happens in casperjs tests weirdly
console.error('this.getDOMNode not a function?');
return;
}
React.unmountComponentAtNode(this.getDOMNode().parentNode);
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this).parentNode);
}
updateStateFromModel() {

View file

@ -14,12 +14,17 @@ class LevelToolbarView extends React.Component {
};
}
componentWillUnmount() {
this._isMounted = false;
}
componentDidMount() {
this._isMounted = true;
this.setState({
isHidden: this.props.parent.getIsGoalExpanded()
isHidden: this.props.parent.getIsGoalExpanded(),
isGoalExpanded: this.props.parent.getIsGoalExpanded()
});
this.props.parent.on('goalToggled', function() {
if (!this.isMounted()) {
if (!this._isMounted) {
return;
}