codeant-ai-for-open-source[bot] commented on code in PR #42142:
URL: https://github.com/apache/superset/pull/42142#discussion_r3696272677


##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -537,8 +544,19 @@ const PropertiesModal = ({
 
   // Section handlers for extracted components
   const handleThemeChange = (value: any) => setSelectedThemeId(value || null);
-  const handleRefreshFrequencyChange = (value: number) =>
+  const handleRefreshFrequencyChange = (value: number) => {
     setRefreshFrequency(value);
+    // Keep the Advanced JSON editor in sync with the dropdown so the two
+    // sources can't diverge, mirroring onColorSchemeChange (#42116). Skip
+    // this while the editor holds invalid/in-progress JSON so we don't
+    // clobber the user's unfinished edit with a one-field object.
+    const jsonMetadataObj = parseJsonMetadata();
+    if (!jsonMetadataObj) {
+      return;
+    }
+    jsonMetadataObj.refresh_frequency = value;

Review Comment:
   **Suggestion:** Valid JSON is not necessarily an object. If the Advanced 
editor contains a primitive such as `1` or `"metadata"`, the truthiness check 
passes and assigning `refresh_frequency` throws a runtime TypeError when the 
dropdown changes. Validate that the parsed value is a non-null object before 
assigning properties, and reject primitive or array metadata as invalid. [type 
error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Refresh dropdown interaction can throw and disrupt modal editing.
   - ⚠️ Users cannot reliably save until metadata becomes an object.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=24d27f0908454277a42a36549ccd4388&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=24d27f0908454277a42a36549ccd4388&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
   **Line:** 553:557
   **Comment:**
        *Type Error: Valid JSON is not necessarily an object. If the Advanced 
editor contains a primitive such as `1` or `"metadata"`, the truthiness check 
passes and assigning `refresh_frequency` throws a runtime TypeError when the 
dropdown changes. Validate that the parsed value is a non-null object before 
assigning properties, and reject primitive or array metadata as invalid.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42142&comment_hash=76a142825ff9aaacf98c3042f66682b60e9e9b76c76530922fee21627e29cea9&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42142&comment_hash=76a142825ff9aaacf98c3042f66682b60e9e9b76c76530922fee21627e29cea9&reaction=dislike'>👎</a>



-- 
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