From notifications-return-51280-apmail-superset-notifications-archive=superset.apache.org@superset.apache.org Wed Sep 16 00:05:45 2020 Return-Path: X-Original-To: apmail-superset-notifications-archive@locus.apache.org Delivered-To: apmail-superset-notifications-archive@locus.apache.org Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by minotaur.apache.org (Postfix) with ESMTP id D9CE61A4C7 for ; Wed, 16 Sep 2020 00:05:44 +0000 (UTC) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id 9BE2D40B73 for ; Wed, 16 Sep 2020 00:05:44 +0000 (UTC) Received: (qmail 89425 invoked by uid 500); 16 Sep 2020 00:05:44 -0000 Delivered-To: apmail-superset-notifications-archive@superset.apache.org Received: (qmail 89405 invoked by uid 500); 16 Sep 2020 00:05:44 -0000 Mailing-List: contact notifications-help@superset.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.apache.org Delivered-To: mailing list notifications@superset.apache.org Received: (qmail 89396 invoked by uid 99); 16 Sep 2020 00:05:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Sep 2020 00:05:44 +0000 From: =?utf-8?q?GitBox?= To: notifications@superset.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bincubator-superset=5D_ktmud_commented_on_a_change_?= =?utf-8?q?in_pull_request_=2310897=3A_fix=3A__front_end_CI_tests_and_test_r?= =?utf-8?q?unner?= Message-ID: <160021474428.32230.11161239465988108221.asfpy@gitbox.apache.org> Date: Wed, 16 Sep 2020 00:05:44 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: 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