Avoid Beat Prompt rerender on focus

This commit is contained in:
2026-08-27 07:02:33 +00:00
parent 4571ea9e31
commit 9067f1fce9
+6 -2
View File
@@ -224,8 +224,10 @@ function findWidget(node, name) {
function hideWidget(node, name) { function hideWidget(node, name) {
const widget = findWidget(node, name); const widget = findWidget(node, name);
if (!widget) return; if (!widget) return;
widget.origType = widget.origType || widget.type;
widget.type = "hidden"; widget.type = "hidden";
widget.computeSize = () => [0, 0]; widget.computeSize = () => [0, 0];
widget.hidden = true;
} }
function writeState(node, state) { function writeState(node, state) {
@@ -309,6 +311,7 @@ function renderUI(node) {
if (!ui) return; if (!ui) return;
const state = readState(node); const state = readState(node);
node._dh3bpRenderedState = JSON.stringify(state);
ui.list.innerHTML = ""; ui.list.innerHTML = "";
state.beats.forEach((beat, index) => { state.beats.forEach((beat, index) => {
@@ -599,7 +602,9 @@ app.registerExtension({
nodeType.prototype.onConfigure = function onConfigure() { nodeType.prototype.onConfigure = function onConfigure() {
const result = originalConfigure?.apply(this, arguments); const result = originalConfigure?.apply(this, arguments);
syncStateFromNode(this); syncStateFromNode(this);
queueMicrotask(() => renderUI(this)); if (this._dh3bpUI && this._dh3bpRenderedState !== this._dh3bpState) {
queueMicrotask(() => renderUI(this));
}
return result; return result;
}; };
@@ -611,7 +616,6 @@ app.registerExtension({
o.properties = o.properties || {}; o.properties = o.properties || {};
o.properties[STATE_PROPERTY] = this.properties[STATE_PROPERTY]; o.properties[STATE_PROPERTY] = this.properties[STATE_PROPERTY];
} }
queueMicrotask(() => renderUI(this));
return result; return result;
}; };