aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-03-19 23:18:37 +0000
committerHayleigh Thompson <me@hayleigh.dev>2024-03-19 23:18:42 +0000
commite6dbabcbe4c0a87909e5c05f68cba4d748debdfd (patch)
treec5a49f8ec00983105eeafbd4a1f457a306e199dc
parent7a96fce836133f97218c494cfe5419245e0146a9 (diff)
downloadlustre-e6dbabcbe4c0a87909e5c05f68cba4d748debdfd.tar.gz
lustre-e6dbabcbe4c0a87909e5c05f68cba4d748debdfd.zip
:bug: Fixed a bug where client components didn't handle the optional on_attribute_change dict.
-rw-r--r--src/client-component.ffi.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client-component.ffi.mjs b/src/client-component.ffi.mjs
index 1a3a7cb..2337f92 100644
--- a/src/client-component.ffi.mjs
+++ b/src/client-component.ffi.mjs
@@ -16,7 +16,7 @@ export function register({ init, update, view, on_attribute_change }, name) {
window.customElements.define(
name,
- makeComponent(init, update, view, on_attribute_change)
+ makeComponent(init, update, view, on_attribute_change),
);
return new Ok(undefined);
@@ -33,7 +33,7 @@ function makeComponent(init, update, view, on_attribute_change) {
constructor() {
super();
- on_attribute_change.forEach((decoder, name) => {
+ on_attribute_change[0]?.forEach((decoder, name) => {
Object.defineProperty(this, name, {
get() {
return this[`_${name}`] || this.getAttribute(name);
@@ -47,7 +47,7 @@ function makeComponent(init, update, view, on_attribute_change) {
this.#application
? this.#application.send(new Dispatch(decoded[0]))
: window.requestAnimationFrame(() =>
- this.#application.send(new Dispatch(decoded[0]))
+ this.#application.send(new Dispatch(decoded[0])),
);
}
@@ -66,7 +66,7 @@ function makeComponent(init, update, view, on_attribute_change) {
init(),
update,
view,
- this.#root
+ this.#root,
);
this.appendChild(this.#root);
}