nytai commented on a change in pull request #9351: fix: don't parseFloat when 
the *already numeric* value ends in a decimal
URL: 
https://github.com/apache/incubator-superset/pull/9351#discussion_r396744939
 
 

 ##########
 File path: superset-frontend/src/explore/components/controls/TextControl.jsx
 ##########
 @@ -55,7 +55,7 @@ export default class TextControl extends React.Component {
       if (error) {
         errors.push(error);
       } else {
-        value = parseFloat(value);
+        value = value.match(/.*(\.)$/g) ? value : parseFloat(value);
 
 Review comment:
   maybe I'm rusty on my regex, but it seems like this would only match strings 
that end in a `.`. The () is also probably unnecessary since you are not using 
the match groups. 
   
   maybe try?
   `/[0-9]*\.[0-9]+$/g`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to