aboutsummaryrefslogtreecommitdiff
path: root/src/client-component.ffi.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-05-14 18:21:29 +0200
committerHayleigh Thompson <me@hayleigh.dev>2024-05-18 09:55:02 +0100
commit6d164196490e12f3d738d32a2435692fd16f689b (patch)
tree1efc0b0fce678b91dcda8778ca7340dcd06f5aa2 /src/client-component.ffi.mjs
parentdee571dd08576221fed28b2851e8dfe26a8129f6 (diff)
downloadlustre-6d164196490e12f3d738d32a2435692fd16f689b.tar.gz
lustre-6d164196490e12f3d738d32a2435692fd16f689b.zip
:bug: Fixed a bug where components would not properly report attribute changes.
Diffstat (limited to 'src/client-component.ffi.mjs')
-rw-r--r--src/client-component.ffi.mjs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client-component.ffi.mjs b/src/client-component.ffi.mjs
index 89e3470..0dfc303 100644
--- a/src/client-component.ffi.mjs
+++ b/src/client-component.ffi.mjs
@@ -53,11 +53,7 @@ function makeComponent(init, update, view, on_attribute_change) {
);
}
- if (typeof value === "string") {
- this.setAttribute(name, value);
- } else {
- this[`_${name}`] = value;
- }
+ this[`_${name}`] = value;
},
});
});
@@ -74,6 +70,10 @@ function makeComponent(init, update, view, on_attribute_change) {
this.appendChild(this.#root);
}
+ attributeChangedCallback(key, _, next) {
+ this[key] = next;
+ }
+
disconnectedCallback() {
this.#application.send(new Shutdown());
}