General react performance improvements (#2796)

* General React performance improvements

* Cleaned up unused props/state in PermaLinkView and PostFocusView
Этот коммит содержится в:
Joram Wilander
2016-04-29 08:40:06 -04:00
коммит произвёл Christopher Speller
родитель 9961ccca7d
Коммит 1f4974dc02
19 изменённых файлов: 255 добавлений и 227 удалений

Просмотреть файл

@@ -42,20 +42,18 @@ export default class NeedsTeam extends React.Component {
this.onChanged = this.onChanged.bind(this);
this.state = {
profiles: UserStore.getProfiles(),
team: TeamStore.getCurrent()
};
}
onChanged() {
this.setState({
profiles: UserStore.getProfiles(),
team: TeamStore.getCurrent()
});
}
componentWillMount() {
// Go to tutorial if we are first arrivign
// Go to tutorial if we are first arriving
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
if (tutorialStep <= TutorialSteps.INTRO_SCREENS) {
browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/tutorial');
@@ -63,7 +61,6 @@ export default class NeedsTeam extends React.Component {
}
componentDidMount() {
UserStore.addChangeListener(this.onChanged);
TeamStore.addChangeListener(this.onChanged);
// Emit view action
@@ -84,7 +81,6 @@ export default class NeedsTeam extends React.Component {
}
componentWillUnmount() {
UserStore.removeChangeListener(this.onChanged);
TeamStore.removeChangeListener(this.onChanged);
$(window).off('focus');
$(window).off('blur');
@@ -114,7 +110,6 @@ export default class NeedsTeam extends React.Component {
<div className='row main'>
{React.cloneElement(this.props.center, {
user: this.props.user,
profiles: this.state.profiles,
team: this.state.team
})}
</div>