bito-code-review[bot] commented on PR #44982:
URL: https://github.com/apache/superset/pull/44982#issuecomment-5991961050

   <!-- Bito Reply -->
   The flagged issue is correct. Using `Number(value)` on `null` or an empty 
string results in `0`, which can incorrectly cause the UI to treat malformed 
configuration as a valid "Don't refresh" option. 
   
   To resolve this, you should validate the input more strictly before 
converting it to a number. The current PR already implements a robust fix in 
`getRefreshFrequencyOptions` by checking `Number.isFinite(seconds)` and 
ensuring the label is a non-empty string. 
   
   If you are referring to the `handleRadioChange` function specifically, you 
can improve the conversion there as well:
   
   ```typescript
     const handleRadioChange = (event: RadioChangeEvent) => {
       const rawValue = event.target.value;
       const selectedValue = rawValue === '' || rawValue === null ? NaN : 
Number(rawValue);
       
       if (Number.isNaN(selectedValue)) {
         return;
       }
       // ... rest of the logic
   ```
   
   I have checked the PR and there are no other pending review comments in the 
provided context. Would you like me to review any other parts of the PR?
   
   
**superset-frontend/src/dashboard/components/RefreshFrequency/RefreshFrequencySelect.tsx**
   ```
   const handleRadioChange = (event: RadioChangeEvent) => {
       const rawValue = event.target.value;
       const selectedValue = rawValue === '' || rawValue === null ? NaN : 
Number(rawValue);
       
       if (Number.isNaN(selectedValue)) {
         return;
       }
       // ... rest of the logic
   ```


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