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 2020/09/16 00:05:44 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #10897: fix: front end CI tests and test runner

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



##########
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:
       Looking good. I think the long-term solution would be to migrate this and all related files to TypeScript so we can be more confident in changes like this.




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