sadpandajoe commented on code in PR #45100:
URL: https://github.com/apache/superset/pull/45100#discussion_r4231803236


##########
superset-frontend/src/features/semanticLayers/SemanticLayerModal.tsx:
##########
@@ -82,6 +83,16 @@ export default function SemanticLayerModal({
   );
   const [formData, setFormData] = useState<Record<string, unknown>>({});
   const [saving, setSaving] = useState(false);
+  const [clearing, setClearing] = useState(false);
+  const [savedForm, setSavedForm] = useState<{
+    name: string;
+    configuration: Record<string, unknown>;
+  } | null>(null);
+  const clearRequestRef = useRef(0);
+  const dirty =

Review Comment:
   `dirty` compares the live form data with the raw saved configuration, but 
`ReadOnlyControl`/`ConstControl` in `jsonFormsHelpers.tsx` call `handleChange` 
on mount to inject the schema `default`/`const` when the stored value differs. 
For a layer whose stored configuration lacks such a field (created through the 
API, or a provider that later added a read-only field with a default), opening 
the editor and touching nothing makes `formData` differ from 
`savedForm.configuration`, so Reload metadata stays disabled and the only way 
to clear is a Save. Should the baseline be normalized the same way (or edits 
tracked separately from schema backfill) so an untouched editor isn't treated 
as dirty?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to