From dc6eb4d4adee7e6a62f6c0ff0e8052629b328806 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 13 Oct 2015 16:58:43 +1030 Subject: [PATCH] Initialise component state in init() instead of constructor --- extensions/flags/js/forum/src/components/FlagList.js | 4 +--- extensions/flags/js/forum/src/components/FlagPostModal.js | 4 ++-- extensions/flags/js/forum/src/components/FlagsDropdown.js | 4 ++-- extensions/flags/js/forum/src/components/FlagsPage.js | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/flags/js/forum/src/components/FlagList.js b/extensions/flags/js/forum/src/components/FlagList.js index e2061e700..69f6b7bc6 100644 --- a/extensions/flags/js/forum/src/components/FlagList.js +++ b/extensions/flags/js/forum/src/components/FlagList.js @@ -6,9 +6,7 @@ import icon from 'flarum/helpers/icon'; import humanTime from 'flarum/helpers/humanTime'; export default class FlagList extends Component { - constructor(...args) { - super(...args); - + init() { /** * Whether or not the notifications are loading. * diff --git a/extensions/flags/js/forum/src/components/FlagPostModal.js b/extensions/flags/js/forum/src/components/FlagPostModal.js index f6f4662e5..1f9579102 100644 --- a/extensions/flags/js/forum/src/components/FlagPostModal.js +++ b/extensions/flags/js/forum/src/components/FlagPostModal.js @@ -2,8 +2,8 @@ import Modal from 'flarum/components/Modal'; import Button from 'flarum/components/Button'; export default class FlagPostModal extends Modal { - constructor(...args) { - super(...args); + init() { + super.init(); this.reason = m.prop(''); this.reasonDetail = m.prop(''); diff --git a/extensions/flags/js/forum/src/components/FlagsDropdown.js b/extensions/flags/js/forum/src/components/FlagsDropdown.js index a597d4036..07c26a29d 100644 --- a/extensions/flags/js/forum/src/components/FlagsDropdown.js +++ b/extensions/flags/js/forum/src/components/FlagsDropdown.js @@ -10,8 +10,8 @@ export default class FlagsDropdown extends NotificationsDropdown { super.initProps(props); } - constructor(...args) { - super(...args); + init() { + super.init(); this.list = new FlagList(); } diff --git a/extensions/flags/js/forum/src/components/FlagsPage.js b/extensions/flags/js/forum/src/components/FlagsPage.js index 908caf191..792d0711b 100644 --- a/extensions/flags/js/forum/src/components/FlagsPage.js +++ b/extensions/flags/js/forum/src/components/FlagsPage.js @@ -7,8 +7,8 @@ import FlagList from 'flarum/flags/components/FlagList'; * used on mobile devices where the flags dropdown is within the drawer. */ export default class FlagsPage extends Page { - constructor(...args) { - super(...args); + init() { + super.init(); app.history.push('flags');