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-14 18:21:29 +0200
commit81ccdd9641b07727249bcdd5d4346b4e097b2dad (patch)
tree9ee1345dabb9c0cf9f07930af3f7de558d04bf69 /src/client-component.ffi.mjs
parent05d86d928e6276d8f40d7d0e6939cb5eae03313d (diff)
downloadlustre-81ccdd9641b07727249bcdd5d4346b4e097b2dad.tar.gz
lustre-81ccdd9641b07727249bcdd5d4346b4e097b2dad.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());
}