From 3bf7f6f85ba4b41bfe3eb71a2d20121cfa2967e4 Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sun, 1 Mar 2020 15:14:00 -0500 Subject: [PATCH] common: modify Component#render to properly do what it is supposed to - modify the original instance --- js/src/common/Component.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/js/src/common/Component.ts b/js/src/common/Component.ts index 2529bee05..a0dc5ab14 100644 --- a/js/src/common/Component.ts +++ b/js/src/common/Component.ts @@ -14,7 +14,7 @@ export default class Component { props: T; constructor(props: T = {}) { - this.props = props; + this.props = props.tag ? {} : props; } view(vnode) { @@ -65,7 +65,18 @@ export default class Component { } render() { - return m(this, this.props); + return m.fragment( + { + ...this.props, + oninit: (...args) => this.oninit(...args), + oncreate: (...args) => this.oncreate(...args), + onbeforeupdate: (...args) => this.onbeforeupdate(...args), + onupdate: (...args) => this.onupdate.bind(...args), + onbeforeremove: (...args) => this.onbeforeremove.bind(...args), + onremove: (...args) => this.onremove.bind(...args), + }, + this.view() + ); } static component(props: ComponentProps | any = {}, children?: Mithril.Children) {