Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove UNSAFE componentWillMount #780

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions huxley/www/js/components/AdvisorRosterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ class AdvisorRosterView extends React.Component {
};
}

UNSAFE_componentWillMount() {
Modal.setAppElement("body");
}

componentDidMount() {
Modal.setAppElement("body");
var schoolID = CurrentUserStore.getCurrentUser().school.id;
var conferenceID = global.conference.session;
this._registrationToken = RegistrationStore.addListener(() => {
Expand Down
13 changes: 0 additions & 13 deletions huxley/www/js/components/AdvisorZoomLinkView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
"use strict";

import React from "react";
import { history } from "utils/history";

var { AssignmentStore } = require("stores/AssignmentStore");
const { Button } = require("components/core/Button");
var { CountryStore } = require("stores/CountryStore");
var { CommitteeStore } = require("stores/CommitteeStore");
var { CurrentUserStore } = require("stores/CurrentUserStore");
var { DelegateStore } = require("stores/DelegateStore");
var { InnerView } = require("components/InnerView");
var { TextTemplate } = require("components/core/TextTemplate");
var { User } = require("utils/User");

require("css/Table.less");
var AdvisorZoomLinkViewText = require("text/AdvisorZoomLinkViewText.md");
Expand All @@ -31,13 +25,6 @@ class AdvisorZoomLinkView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isAdvisor(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._committeesToken = CommitteeStore.addListener(() => {
var committees = Object.values(CommitteeStore.getCommittees());
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/ChairAttendanceView.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ class ChairAttendanceView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
var user = CurrentUserStore.getCurrentUser();
var attendance = this.state.attendance;
Expand Down
8 changes: 0 additions & 8 deletions huxley/www/js/components/ChairCommitteeFeedbackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const { CurrentUserStore } = require("stores/CurrentUserStore");
const { InnerView } = require("components/InnerView");
const { Table } = require("components/core/Table");
const { TextTemplate } = require("components/core/TextTemplate");
const { User } = require("utils/User");

require("css/Table.less");
const ChairCommitteeFeedbackViewText = require("text/ChairCommitteeFeedbackViewText.md");
Expand All @@ -36,13 +35,6 @@ class ChairCommitteeFeedbackView extends React.Component {
});
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentsWillUnmount() {
this._committeeFeedbackToken && this._committeeFeedbackToken.remove();
}
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/ChairDelegateEmailView.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ class ChairDelegateEmailView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
var user = CurrentUserStore.getCurrentUser();

Expand Down
9 changes: 1 addition & 8 deletions huxley/www/js/components/ChairFeedView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import React from "react";
import { history } from "utils/history";
import type { Assignment, Committee, Note } from "utils/types";
import type { Assignment, Note } from "utils/types";
import { NoteFeedBox } from "./notes/NoteFeedBox";

const { AssignmentStore } = require("stores/AssignmentStore");
Expand Down Expand Up @@ -79,13 +79,6 @@ class ChairFeedView extends React.Component<{}, ChairFeedViewState> {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._conversationToken = NoteStore.addListener(() => {
this.setState({
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/ChairNoteView.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ class ChairNoteView extends React.Component<{}, ChairNoteViewState> {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._conversationToken = NoteStore.addListener(() => {
this.setState({
Expand Down
6 changes: 0 additions & 6 deletions huxley/www/js/components/ChairPapersView.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ class ChairPapersView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
var user = CurrentUserStore.getCurrentUser();
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/ChairRubricView.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ class ChairRubricView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._committeesToken = CommitteeStore.addListener(() => {
var user = CurrentUserStore.getCurrentUser();
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/ChairSummaryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ class ChairSummaryView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isChair(user)) {
history.redirect("/");
}
}

componentDidMount() {
var user = CurrentUserStore.getCurrentUser();

Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/DelegateCommitteeFeedbackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@ class DelegateCommitteeFeedbackView extends React.Component {
});
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isDelegate(user)) {
history.redirect("/");
}
}

componentWillUnmount() {
this._committeeFeedbackToken && this._committeeFeedbackToken.remove();
this._secretariatMembersToken && this._secretariatMembersToken.remove();
Expand Down
9 changes: 1 addition & 8 deletions huxley/www/js/components/DelegateNoteView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use of this source code is governed by a BSD License (see LICENSE).
+*/

//@flow
// @flow

"use strict";

Expand Down Expand Up @@ -91,13 +91,6 @@ class DelegateNoteView extends React.Component<{}, DelegateNoteViewState> {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isDelegate(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._conversationToken = NoteStore.addListener(() => {
this.setState({
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/DelegatePaperView.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ class DelegatePaperView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isDelegate(user)) {
history.redirect("/");
}
}

componentDidMount() {
this._papersToken = PositionPaperStore.addListener(() => {
this.setState({
Expand Down
7 changes: 0 additions & 7 deletions huxley/www/js/components/DelegateProfileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ class DelegateProfileView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (!User.isDelegate(user)) {
history.redirect("/");
}
}

render() {
var user = CurrentUserStore.getCurrentUser();
var delegate = this.state.delegate;
Expand Down
5 changes: 3 additions & 2 deletions huxley/www/js/components/Huxley.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ require("css/JSWarning.less");
require("css/IEWarning.less");

class Huxley extends React.Component {
UNSAFE_componentWillMount() {

componentDidMount() {
CurrentUserStore.addListener(() => {
var user = CurrentUserStore.getCurrentUser();
if (User.isAnonymous(user)) {
Expand All @@ -72,7 +73,7 @@ class Huxley extends React.Component {
}
});
}

render() {
var user = CurrentUserStore.getCurrentUser();
if (User.isAnonymous(user)) {
Expand Down
10 changes: 0 additions & 10 deletions huxley/www/js/components/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ class LoginView extends React.Component {
};
}

UNSAFE_componentWillMount() {
var user = CurrentUserStore.getCurrentUser();
if (User.isAnonymous(user)) {
return;
}
if (User.isAdvisor(user)) {
history.redirect("/advisor/profile");
}
}

render() {
return (
<OuterView header={this.renderHeader()}>
Expand Down