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 2021/02/10 00:21:03 UTC

[GitHub] [superset] rusackas commented on a change in pull request #13037: feat: add autocopy functionality to CopyToClipboard (#10328)

rusackas commented on a change in pull request #13037:
URL: https://github.com/apache/superset/pull/13037#discussion_r573347583



##########
File path: superset-frontend/src/components/Button/index.tsx
##########
@@ -144,6 +144,17 @@ export default function Button(props: ButtonProps) {
     colorHover = primary.base;
   }
 
+  const element = children as ReactElement;
+
+  let renderedChildren = [];
+  if (element && element.type === React.Fragment) {
+    renderedChildren = Children.toArray(element.props.children);
+  } else {
+    renderedChildren = Children.toArray(children);
+  }
+

Review comment:
       ```suggestion
   const renderedChildren = Children.toArray(element?.type == React.Fragment ? element.props.children : children);
   ```
   Not sure if it's easier to read in a one liner and/or with a null-coalescing operator. ¯\\\_(ツ)_/¯ 




----------------------------------------------------------------
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:
users@infra.apache.org



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