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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Fix: 86evjf83e : Builder/Components - Prettify Feature Breaks Note Component Grouping
samme-abduladeec9f2246b
diff --git a/packages/app/src/builder-ui/workspace/ComponentSort.ts b/packages/app/src/builder-ui/workspace/ComponentSort.tsindex 5c197406..4c3cf513 100644--- a/packages/app/src/builder-ui/workspace/ComponentSort.ts+++ b/packages/app/src/builder-ui/workspace/ComponentSort.ts@@ -160,6 +160,46 @@ async function extractWorkflows(data) {return workflows;}+/**+ * Checks if a component is completely inside a note element+ */+function isComponentInsideNote(compEl: HTMLElement, noteEl: HTMLElement): boolean {+ const compRect = compEl.getBoundingClientRect();+ const noteRect = noteEl.getBoundingClientRect();+ return (+ compRect.left >= noteRect.left &&+ compRect.right <= noteRect.right &&+ compRect.top >= noteRect.top &&+ compRect.bottom <= noteRect.bottom+ );+}++/**+ * Filters workflows to exclude those containing components inside notes+ */+function filterWorkflowsWithoutNoteGrouping(workflows, allNoteComponents): typeof workflows {+ // Get all note DOM elements once+ const noteElements = allNoteComponents+ .map((note) => document.getElementById(note.id))+ .filter((el) => el !== null);++ if (noteElements.length === 0) return workflows;++ return workflows.filter((wf) => {+ for (const comp of wf.components) {+ const compEl = document.getElementById(comp.id);+ if (!compEl) continue;++ for (const noteEl of noteElements) {+ if (isComponentInsideNote(compEl, noteEl)) {+ return false;+ }+ }+ }+ return true;+ });+}+async function moveFlow(wf, x, y) {for (let c of wf.components) {const dom = document.getElementById(c.id);@@ -298,14 +338,17 @@ async function sortAll() {const workflows = await extractWorkflows(agentData);await delay(50);+ const allNotes = agentData.components.filter((c) => c.name === 'Note');+ const workflowsToSort = filterWorkflowsWithoutNoteGrouping(workflows, allNotes);+await workspace.export();await delay(200);workspace.lock();// Process workflows in smaller batches if there are many componentsconst BATCH_SIZE = 10;- for (let i = 0; i < workflows.length; i += BATCH_SIZE) {- const batch = workflows.slice(i, i + BATCH_SIZE);+ for (let i = 0; i < workflowsToSort.length; i += BATCH_SIZE) {+ const batch = workflowsToSort.slice(i, i + BATCH_SIZE);for (let wf of batch) {await organizeComponents(wf.components, wf.box.x, wf.box.y);}@@ -313,9 +356,9 @@ async function sortAll() {}await delay(100);- updateWFBoundingBox(workflows);+ updateWFBoundingBox(workflowsToSort);await delay(100);- await alignBoxes(workflows);+ await alignBoxes(workflowsToSort);await delay(200); // Increased delay to ensure DOM updates are complete//workspace.jsPlumbInstance.repaintEverything();} catch (error) {@@ -353,10 +396,11 @@ async function sortSelection() {return;}- //find workflows containing selected components- const selectedWorkflows = workflows.filter((wf) =>+ const allNotes = agentData.components.filter((c) => c.name === 'Note');+ const workflowsWithSelection = workflows.filter((wf) =>selectedComponents.some((c) => wf.components.some((wc) => wc.id === c.id)),);+ const selectedWorkflows = filterWorkflowsWithoutNoteGrouping(workflowsWithSelection, allNotes);workspace.lock();//sort selected workflows