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.
   you do have to coerce the value twice this way b/c the value is defined in 
the code multiple times depending on the conditions.




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



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

Reply via email to