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


##########
superset-frontend/src/features/themes/ThemeModal.tsx:
##########
@@ -325,6 +373,15 @@ const ThemeModal: FunctionComponent<ThemeModalProps> = ({
     [currentTheme],
   );
 
+  const onEditorsChange = useCallback((values: SubjectPickerValue[]) => {
+    setCurrentTheme(prev => ({
+      ...prev,
+      theme_name: prev?.theme_name || '',
+      json_data: prev?.json_data || '',
+      editors: values || [],

Review Comment:
   **Suggestion:** Editor selections are now stored in `currentTheme`, but 
`hasUnsavedChanges` still compares only `theme_name` and `json_data`. Adding, 
removing, or replacing editors without changing either of those fields will 
therefore close the modal without the discard confirmation and silently lose 
the editor changes. Include the editor selection in the dirty-state comparison. 
[state/lifecycle]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Theme editor assignments can be silently discarded.
   - ⚠️ Cancel and browser-navigation warnings omit editor changes.
   - ⚠️ Users may believe editor access changes were retained.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/features/themes/ThemeModal.tsx
   **Line:** 381:381
   **Comment:**
        *State Lifecycle: Editor selections are now stored in `currentTheme`, 
but `hasUnsavedChanges` still compares only `theme_name` and `json_data`. 
Adding, removing, or replacing editors without changing either of those fields 
will therefore close the modal without the discard confirmation and silently 
lose the editor changes. Include the editor selection in the dirty-state 
comparison.
   
   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%2F42404&comment_hash=26611ddfaefa656ff7f11c34591cf7d950ae0c7b9be22fd3f118b5a708a04bd2&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42404&comment_hash=26611ddfaefa656ff7f11c34591cf7d950ae0c7b9be22fd3f118b5a708a04bd2&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