superset-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-superset] eschutho commented on a change in pull request #10897: Fix front end CI tests and test runner
Date Wed, 16 Sep 2020 00:02:37 GMT

eschutho commented on a change in pull request #10897:
URL: https://github.com/apache/incubator-superset/pull/10897#discussion_r489080674



##########
File path: superset-frontend/src/dashboard/util/getComponentWidthFromDrop.js
##########
@@ -37,39 +37,49 @@ export default function getComponentWidthFromDrop({
     return component.meta.width;
   }
 
-  const draggingWidth = getDetailedComponentWidth({
+  const {
+    width: draggingWidth,
+    minimumWidth: minDraggingWidth,
+  } = getDetailedComponentWidth({
     component,
     components,
   });
 
-  const destinationWidth = getDetailedComponentWidth({
+  const {
+    width: destinationWidth,
+    occupiedWidth: draggingOccupiedWidth,
+  } = getDetailedComponentWidth({
     id: destination.id,
     components,
   });
 
-  let destinationCapacity =
-    destinationWidth.width - destinationWidth.occupiedWidth;
+  let destinationCapacity = Number(destinationWidth - draggingOccupiedWidth);
 
   if (Number.isNaN(destinationCapacity)) {
-    const grandparentWidth = getDetailedComponentWidth({
+    const {
+      width: grandparentWidth,
+      occupiedWidth: grandparentOccupiedWidth,
+    } = getDetailedComponentWidth({
       id: findParentId({
         childId: destination.id,
         layout: components,
       }),
       components,
     });
 
-    destinationCapacity =
-      grandparentWidth.width - grandparentWidth.occupiedWidth;
+    destinationCapacity = Number(grandparentWidth - grandparentOccupiedWidth);
   }
 
-  if (Number.isNaN(destinationCapacity) || Number.isNaN(draggingWidth.width)) {
-    return draggingWidth.width;
+  if (
+    Number.isNaN(destinationCapacity) ||
+    Number.isNaN(Number(draggingWidth))
+  ) {
+    return draggingWidth;

Review comment:
       @ktmud does this look more readable to you? It keeps the original return value here,
to play it safe.
   The value is coerced multiple times this way b/c it is defined multiple times depending
on the condition.




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


Mime
View raw message