Initialise component state in init() instead of constructor

This commit is contained in:
Toby Zerner 2015-10-13 16:59:23 +10:30
parent 1d5a118951
commit 67c1d79c5c
3 changed files with 5 additions and 7 deletions

View File

@ -9,8 +9,8 @@ import tagLabel from 'flarum/tags/helpers/tagLabel';
* to create or edit a tag. * to create or edit a tag.
*/ */
export default class EditTagModal extends Modal { export default class EditTagModal extends Modal {
constructor(...args) { init() {
super(...args); super.init();
this.tag = this.props.tag || app.store.createRecord('tags'); this.tag = this.props.tag || app.store.createRecord('tags');

View File

@ -10,8 +10,8 @@ import tagIcon from 'flarum/tags/helpers/tagIcon';
import sortTags from 'flarum/tags/utils/sortTags'; import sortTags from 'flarum/tags/utils/sortTags';
export default class TagDiscussionModal extends Modal { export default class TagDiscussionModal extends Modal {
constructor(...args) { init() {
super(...args); super.init();
this.tags = sortTags(app.store.all('tags').filter(tag => tag.canStartDiscussion())); this.tags = sortTags(app.store.all('tags').filter(tag => tag.canStartDiscussion()));

View File

@ -7,9 +7,7 @@ import tagLabel from 'flarum/tags/helpers/tagLabel';
import sortTags from 'flarum/tags/utils/sortTags'; import sortTags from 'flarum/tags/utils/sortTags';
export default class TagsPage extends Component { export default class TagsPage extends Component {
constructor(...args) { init() {
super(...args);
this.tags = sortTags(app.store.all('tags').filter(tag => !tag.parent())); this.tags = sortTags(app.store.all('tags').filter(tag => !tag.parent()));
app.current = this; app.current = this;