-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the bug
Custom elements have numerous callbacks and these should untrack to avoid recursion. This is a bit tricky because a lot of DOM methods for manipulation could cause the callbacks to fire.
Your Example Website or App
https://playground.solidjs.com/anonymous/b6031b3f-7ce9-4322-a06f-31823340af8d
Steps to Reproduce the Bug or Issue
Testing code is the following
import { render } from "solid-js/web";
import { createSignal } from "solid-js";
const [read, write] = createSignal(true);
function recurse(name, ...args) {
console.log(name, ...args);
write(!read());
}
class CustomElement extends HTMLElement {
static observedAttributes = ["string-attribute"];
constructor() {
super();
recurse("constructor");
}
connectedCallback() {
recurse("Custom element added to page.");
}
disconnectedCallback() {
recurse("Custom element removed from page.");
}
adoptedCallback() {
recurse("Custom element moved to new page.");
}
attributeChangedCallback(name, oldValue, newValue) {
recurse(`Attribute ${name} has changed.`, oldValue, newValue);
}
set boolean(value) {
recurse(`boolean has changed.`, value);
}
}
customElements.define("custom-element", CustomElement);
render(
() => () => (
<custom-element string-attribute="lala" boolean={true}>
Test
</custom-element>
),
document.getElementById("app")!,
);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request