This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch live-edits
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a36bd77beb8c914f818dd35e4e011d84b17b9d00
Author: Evan Rusackas <[email protected]>
AuthorDate: Thu Jan 8 17:33:47 2026 -0800

    fix(dashboard): properly detect entering vs exiting controlled edit mode
    
    Use a ref to track previous isEditing state. This distinguishes:
    - Entering controlled mode: isEditing=false, prevIsEditing=false → skip 
notify
    - Exiting edit mode: isEditing=false, prevIsEditing=true → notify parent
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
---
 .../superset-ui-core/src/components/EditableTitle/index.tsx   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/index.tsx
 
b/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/index.tsx
index 23a85cb3818..a0077a4f721 100644
--- 
a/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/index.tsx
+++ 
b/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/index.tsx
@@ -94,6 +94,7 @@ export function EditableTitle({
   const [lastTitle, setLastTitle] = useState(title);
   const [inputWidth, setInputWidth] = useState<number>(0);
   const contentRef = useRef<TextAreaRef>(null);
+  const prevIsEditingRef = useRef(isEditing);
 
   function measureTextWidth(text: string, font = '14px Arial') {
     const canvas = document.createElement('canvas');
@@ -139,11 +140,15 @@ export function EditableTitle({
         textArea.scrollTop = textArea.scrollHeight;
       }
     }
-    // Don't notify parent during controlled mode sync
-    // (when editing prop is true but local state hasn't caught up yet)
-    if (!(editing && !isEditing)) {
+    // Skip notification only when entering controlled mode
+    // (editing=true, isEditing=false, and isEditing was already false before)
+    // This distinguishes from exiting edit mode (where prevIsEditing was true)
+    const isEnteringControlledMode =
+      editing && !isEditing && !prevIsEditingRef.current;
+    if (!isEnteringControlledMode) {
       onEditingChange?.(isEditing);
     }
+    prevIsEditingRef.current = isEditing;
   }, [isEditing, editing, onEditingChange]);
 
   function handleClick() {

Reply via email to