Skip to content

Automate browser based workflows with AI

fix(SKY-10991): stop max update depth loop on workflow build page (#6660)

Celal Zamanoğlu44f45b020322
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
index 30867574b..985b58b50 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
@@ -6,7 +6,7 @@ import {
} from "@/components/ui/tooltip";
import { cn } from "@/util/utils";
import { HorizontallyResizingInput } from "./HorizontallyResizingInput";
-import { useLayoutEffect, useRef, useState } from "react";
+import { useRef, useState } from "react";
type Props = {
value: string;
@@ -27,24 +27,14 @@ function EditableNodeTitle({
const [isTruncated, setIsTruncated] = useState(false);
const titleRef = useRef<HTMLHeadingElement>(null);
- useLayoutEffect(() => {
- if (editing) {
- return;
- }
+ // Measure on hover rather than via a persistent ResizeObserver: an
+ // observer-driven setState here feeds a canvas relayout loop (React #185).
+ const measureTruncation = () => {
const el = titleRef.current;
- if (!el) {
- return;
- }
- const measure = () => {
+ if (el) {
setIsTruncated(el.scrollWidth > el.clientWidth);
- };
- measure();
- const observer = new ResizeObserver(measure);
- observer.observe(el);
- return () => {
- observer.disconnect();
- };
- }, [value, editing]);
+ }
+ };
if (!editing) {
return (
@@ -54,6 +44,7 @@ function EditableNodeTitle({
<h1
ref={titleRef}
className={cn("min-w-0 cursor-text truncate", titleClassName)}
+ onPointerEnter={measureTruncation}
onClick={() => {
setEditing(true);
}}