Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Enhance settings change detection logic in Component class

Muhammad Hamza Khanee5c95bc77bf
diff --git a/packages/app/src/builder-ui/components/Component.class/index.ts b/packages/app/src/builder-ui/components/Component.class/index.ts
index 17a3ee81..b1a32afa 100644
--- a/packages/app/src/builder-ui/components/Component.class/index.ts
+++ b/packages/app/src/builder-ui/components/Component.class/index.ts
@@ -1777,18 +1777,31 @@ export class Component extends EventEmitter {
if (this.properties.template) {
const templateData = this.data._templateVars;
- for (let name in entries) {
- if (
- Object.prototype.hasOwnProperty.call(templateData, name) &&
- !isEqual(templateData[name], values[name])
- )
- return true;
+ const includedSettings = this.properties?.template?.templateInfo?.includedSettings || [];
- if (
- Object.prototype.hasOwnProperty.call(entries, name) &&
- !isEqual(entries[name]?.value, values[name])
- )
- return true;
+ for (let name in entries) {
+ // Check if this is an included setting (compare against component.data)
+ if (includedSettings.includes(name)) {
+ if (
+ Object.prototype.hasOwnProperty.call(this.data, name) &&
+ !isEqual(this.data[name], values[name])
+ ) {
+ return true;
+ }
+ }
+ // Check if this is a template variable (compare against _templateVars)
+ else if (Object.prototype.hasOwnProperty.call(templateData, name)) {
+ if (!isEqual(templateData[name], values[name])) {
+ return true;
+ }
+ }
+ // Fallback: if entry exists in settingsEntries but not in either category,
+ // compare against the initial value from settingsEntries
+ else {
+ if (entries[name]?.value !== undefined && !isEqual(entries[name].value, values[name])) {
+ return true;
+ }
+ }
}
} else {
for (let name in entries) {
@@ -1799,6 +1812,8 @@ export class Component extends EventEmitter {
return true;
}
}
+
+ return false;
}
public async closeSettings(force = false) {
return closeSettings(this, force);