You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "richardfogaca (via GitHub)" <gi...@apache.org> on 2025/11/07 22:58:53 UTC

[PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

richardfogaca opened a new pull request, #36045:
URL: https://github.com/apache/superset/pull/36045

   ### SUMMARY
     Fixes validation error icon appearing in Dashboard Properties modal when opened from dashboard list.
   
     **Problem**: When opening the Dashboard Properties modal by clicking "Edit" from the dashboard list, a validation error icon would appear next to "General information" even though the required "Name" field was populated. The error would persist until the user modified and restored the name field.
   
     **Root Cause**: The modal has two entry points with different initialization patterns:
     1. **Dashboard List**: Passes only `dashboardId`, modal fetches data asynchronously
     2. **Dashboard Edit Mode**: Passes pre-loaded `dashboardInfo` and `dashboardTitle`
   
     The validation `useEffect` hooks were running immediately when the modal opened, before the data fetch completed in the first scenario. This caused validation to run against empty form fields, triggering false validation errors.
   
     **Solution**: Added `isLoading` checks to validation `useEffect` hooks to prevent validation from running until dashboard data has been fully loaded. This ensures validation only runs against populated form fields, eliminating false positives.
   
     ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
     **Before**: Opening modal from dashboard list shows validation error icon next to "General information" despite name field being filled.
   <img width="606" height="791" alt="92750" src="https://github.com/user-attachments/assets/2350af04-b8b2-4016-b906-ff2cb8e4bd6c" />
   
   
     **After**: No validation error appears when opening from dashboard list with properly filled fields.
   <img width="573" height="241" alt="Screenshot 2025-11-07 at 19 54 06" src="https://github.com/user-attachments/assets/f9053b64-b833-46d4-8fa9-bdbe92a260c6" />
   
     ### TESTING INSTRUCTIONS
     1. Navigate to the Dashboard List page
     2. Click the "Edit" icon on any dashboard row
     3. Verify the Dashboard Properties modal opens without a validation error icon next to "General information"
     4. Verify the dashboard name is populated in the form
     5. Also test opening the modal from dashboard edit mode (click "Edit dashboard" → "Edit properties" from menu)
     6. Verify both entry points work correctly without false validation errors
   
     ### ADDITIONAL INFORMATION
     - [ ] Has associated issue:
     - [ ] Required feature flags:
     - [x] Changes UI
     - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
       - [ ] Migration is atomic, supports rollback & is backwards-compatible
       - [ ] Confirm DB migration upgrade and downgrade tested
       - [ ] Runtime estimates and downtime expectations provided
     - [ ] Introduces new feature or API
     - [ ] Removes existing feature or API


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
richardfogaca commented on PR #36045:
URL: https://github.com/apache/superset/pull/36045#issuecomment-3514256499

   suggestions applied, thanks @msyavuz 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36045:
URL: https://github.com/apache/superset/pull/36045#issuecomment-3511545929

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/19232280258) for [6688148](https://github.com/apache/superset/commit/6688148)
   
   • **Environment:** http://34.221.17.13:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36045:
URL: https://github.com/apache/superset/pull/36045#issuecomment-3511464392

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/19232280258) for [6688148](https://github.com/apache/superset/commit/6688148)


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #36045:
URL: https://github.com/apache/superset/pull/36045#issuecomment-3505298575

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #36045:
URL: https://github.com/apache/superset/pull/36045#discussion_r2505794798


##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -630,7 +636,9 @@ const PropertiesModal = ({
         onFinish={onFinish}
         onFieldsChange={() => {
           // Re-validate sections when form fields change
-          setTimeout(() => validateSection('basic'), 100);
+          if (!isLoading) {
+            setTimeout(() => validateSection('basic'), 100);

Review Comment:
   ### Unnecessary setTimeout in form validation <sub>![category Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Using setTimeout with a fixed 100ms delay for form validation creates unnecessary performance overhead and potential race conditions.
   
   
   ###### Why this matters
   The arbitrary delay adds latency to validation feedback and may cause validation to run after the component has unmounted or state has changed, leading to stale closures and wasted computation cycles.
   
   ###### Suggested change ∙ *Feature Preview*
   Remove the setTimeout wrapper and call validateSection('basic') directly, or use a debounced validation approach if frequent validation calls are a concern:
   ```typescript
   if (!isLoading) {
     validateSection('basic');
   }
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f4746199-4e1d-4176-926e-36d40c347950/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f4746199-4e1d-4176-926e-36d40c347950?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f4746199-4e1d-4176-926e-36d40c347950?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f4746199-4e1d-4176-926e-36d40c347950?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/f4746199-4e1d-4176-926e-36d40c347950)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:566e274c-fc78-4cce-a648-087ae4ec839d -->
   
   
   [](566e274c-fc78-4cce-a648-087ae4ec839d)



##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -588,18 +588,24 @@ const PropertiesModal = ({
 
   // Validate basic section when title changes
   useEffect(() => {
-    validateSection('basic');
-  }, [dashboardTitle, validateSection]);
+    if (!isLoading) {
+      validateSection('basic');
+    }
+  }, [dashboardTitle, validateSection, isLoading]);

Review Comment:
   ### Validation skipped during loading state <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The validation logic prevents validation from running during loading state, but this creates a gap where validation may never occur if the component unmounts or state changes while loading.
   
   
   ###### Why this matters
   If the modal is closed or the component unmounts while `isLoading` is true, the validation will never run, potentially leaving the form in an invalid state without user feedback. This could lead to silent validation failures.
   
   ###### Suggested change ∙ *Feature Preview*
   Add a cleanup effect to ensure validation runs when loading completes, or validate immediately after loading state changes:
   
   ```typescript
   useEffect(() => {
     validateSection('basic');
   }, [dashboardTitle, validateSection]);
   
   // Separate effect for post-loading validation
   useEffect(() => {
     if (!isLoading) {
       validateSection('basic');
       validateSection('advanced');
       validateSection('refresh');
     }
   }, [isLoading, validateSection]);
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a40b12ae-3ac9-4000-be96-93ffe07d67ab/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a40b12ae-3ac9-4000-be96-93ffe07d67ab?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a40b12ae-3ac9-4000-be96-93ffe07d67ab?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a40b12ae-3ac9-4000-be96-93ffe07d67ab?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a40b12ae-3ac9-4000-be96-93ffe07d67ab)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:81bab707-fd49-4a35-a415-d8006de94fdc -->
   
   
   [](81bab707-fd49-4a35-a415-d8006de94fdc)



##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -630,7 +636,9 @@ const PropertiesModal = ({
         onFinish={onFinish}
         onFieldsChange={() => {
           // Re-validate sections when form fields change
-          setTimeout(() => validateSection('basic'), 100);
+          if (!isLoading) {
+            setTimeout(() => validateSection('basic'), 100);

Review Comment:
   ### Inconsistent validation timing in field changes <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The setTimeout validation in onFieldsChange callback is not protected by the isLoading check consistently with other validation calls, and the 100ms delay is arbitrary without cleanup.
   
   
   ###### Why this matters
   This creates inconsistent validation behavior where field changes can trigger validation during loading state while other triggers cannot. The setTimeout also lacks cleanup, potentially causing validation to run after component unmount.
   
   ###### Suggested change ∙ *Feature Preview*
   Use consistent validation logic and add proper cleanup:
   
   ```typescript
   onFieldsChange={() => {
     if (!isLoading) {
       // Use a ref to track the timeout for cleanup
       const timeoutId = setTimeout(() => validateSection('basic'), 100);
       return () => clearTimeout(timeoutId);
     }
   }}
   ```
   
   Or better yet, remove the arbitrary delay:
   
   ```typescript
   onFieldsChange={() => {
     if (!isLoading) {
       validateSection('basic');
     }
   }}
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/aafc27af-3e3e-4eec-a206-d776f759aebf/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/aafc27af-3e3e-4eec-a206-d776f759aebf?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/aafc27af-3e3e-4eec-a206-d776f759aebf?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/aafc27af-3e3e-4eec-a206-d776f759aebf?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/aafc27af-3e3e-4eec-a206-d776f759aebf)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:14756d24-c514-4b3d-bdf5-e2ed456d8d5d -->
   
   
   [](14756d24-c514-4b3d-bdf5-e2ed456d8d5d)



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #36045:
URL: https://github.com/apache/superset/pull/36045#discussion_r2511024922


##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -586,20 +586,26 @@ const PropertiesModal = ({
     sections: modalSections,
   });
 
-  // Validate basic section when title changes
+  // Validate basic section when title changes or data loads
   useEffect(() => {
-    validateSection('basic');
-  }, [dashboardTitle, validateSection]);
+    if (!isLoading && dashboardInfo) {

Review Comment:
   This check seems like a good candidate to extract out



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(dashboard): prevent validation error in properties modal when ope… [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #36045:
URL: https://github.com/apache/superset/pull/36045


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org