Avoid Beat Prompt rerender on focus
This commit is contained in:
@@ -224,8 +224,10 @@ function findWidget(node, name) {
|
||||
function hideWidget(node, name) {
|
||||
const widget = findWidget(node, name);
|
||||
if (!widget) return;
|
||||
widget.origType = widget.origType || widget.type;
|
||||
widget.type = "hidden";
|
||||
widget.computeSize = () => [0, 0];
|
||||
widget.hidden = true;
|
||||
}
|
||||
|
||||
function writeState(node, state) {
|
||||
@@ -309,6 +311,7 @@ function renderUI(node) {
|
||||
if (!ui) return;
|
||||
|
||||
const state = readState(node);
|
||||
node._dh3bpRenderedState = JSON.stringify(state);
|
||||
ui.list.innerHTML = "";
|
||||
|
||||
state.beats.forEach((beat, index) => {
|
||||
@@ -599,7 +602,9 @@ app.registerExtension({
|
||||
nodeType.prototype.onConfigure = function onConfigure() {
|
||||
const result = originalConfigure?.apply(this, arguments);
|
||||
syncStateFromNode(this);
|
||||
queueMicrotask(() => renderUI(this));
|
||||
if (this._dh3bpUI && this._dh3bpRenderedState !== this._dh3bpState) {
|
||||
queueMicrotask(() => renderUI(this));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
@@ -611,7 +616,6 @@ app.registerExtension({
|
||||
o.properties = o.properties || {};
|
||||
o.properties[STATE_PROPERTY] = this.properties[STATE_PROPERTY];
|
||||
}
|
||||
queueMicrotask(() => renderUI(this));
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user