Initialise component state in init() instead of constructor

This commit is contained in:
Toby Zerner
2015-10-13 16:58:43 +10:30
parent 41985eb0c3
commit dc6eb4d4ad
4 changed files with 7 additions and 9 deletions

View File

@ -6,9 +6,7 @@ import icon from 'flarum/helpers/icon';
import humanTime from 'flarum/helpers/humanTime'; import humanTime from 'flarum/helpers/humanTime';
export default class FlagList extends Component { export default class FlagList extends Component {
constructor(...args) { init() {
super(...args);
/** /**
* Whether or not the notifications are loading. * Whether or not the notifications are loading.
* *

View File

@ -2,8 +2,8 @@ import Modal from 'flarum/components/Modal';
import Button from 'flarum/components/Button'; import Button from 'flarum/components/Button';
export default class FlagPostModal extends Modal { export default class FlagPostModal extends Modal {
constructor(...args) { init() {
super(...args); super.init();
this.reason = m.prop(''); this.reason = m.prop('');
this.reasonDetail = m.prop(''); this.reasonDetail = m.prop('');

View File

@ -10,8 +10,8 @@ export default class FlagsDropdown extends NotificationsDropdown {
super.initProps(props); super.initProps(props);
} }
constructor(...args) { init() {
super(...args); super.init();
this.list = new FlagList(); this.list = new FlagList();
} }

View File

@ -7,8 +7,8 @@ import FlagList from 'flarum/flags/components/FlagList';
* used on mobile devices where the flags dropdown is within the drawer. * used on mobile devices where the flags dropdown is within the drawer.
*/ */
export default class FlagsPage extends Page { export default class FlagsPage extends Page {
constructor(...args) { init() {
super(...args); super.init();
app.history.push('flags'); app.history.push('flags');