From 2f01c4632cf859fb04a2116ce229c8ac4e5af205 Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 1 Dec 2023 08:41:10 +0100 Subject: [PATCH] feat: initial attach effect --- src/WebComponent.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/WebComponent.js b/src/WebComponent.js index 44d9480..313cc20 100644 --- a/src/WebComponent.js +++ b/src/WebComponent.js @@ -95,7 +95,7 @@ export class WebComponent extends HTMLElement { this[property] = currentValue === "" || currentValue; this[camelCaps] = this[property]; // remove on v2 - this.#handleUpdateProp(camelCaps, currentValue); + this.#handleUpdateProp(camelCaps, this[property]); this.render(); this.onChanges({ property, previousValue, currentValue }); @@ -161,8 +161,11 @@ export class WebComponent extends HTMLElement { return true; }, get(obj, prop) { - Object.getPrototypeOf(obj[prop]).proxy = meta.#props; - Object.getPrototypeOf(obj[prop]).prop = prop; + // TODO: handle non-objects + if(obj[prop] !== null && obj[prop] !== undefined) { + Object.getPrototypeOf(obj[prop]).proxy = meta.#props; + Object.getPrototypeOf(obj[prop]).prop = prop; + } return obj[prop]; }, };