You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/12/01 08:06:05 UTC

[GitHub] [superset] villebro commented on a diff in pull request #22292: Avoid filtering falsy values from clipboard output

villebro commented on code in PR #22292:
URL: https://github.com/apache/superset/pull/22292#discussion_r1036799197


##########
superset-frontend/src/utils/common.js:
##########
@@ -86,7 +86,7 @@ export function prepareCopyToClipboardTabularData(data, columns) {
       // JavaScript does not maintain the order of a mixed set of keys (i.e integers and strings)
       // the below function orders the keys based on the column names.
       const key = columns[j].name || columns[j];
-      if (key in data[i]) {
+      if (data[i][key] === undefined || data[i][key] === null) {

Review Comment:
   as we are referencing `data[i][key]` three times, can we first assign it to a variable? Also, we have a helper function `isDefined` which we could use. So something like this:
   ```javascript
   const value = data[i][key];
   if (isDefined(value) {
     ...
   }
   ```



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