From a72f6ec8b524334d9ba566554e74e3019d92aa09 Mon Sep 17 00:00:00 2001 From: olav Date: Thu, 31 Mar 2022 15:05:05 +0200 Subject: [PATCH] chore: update react-dnd (#834) * chore: update react-dnd * refactor: add missing react-dnd types --- frontend/package.json | 4 +- .../EnvironmentListItem.tsx | 8 ++- frontend/yarn.lock | 56 +++++++++---------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 053cc612b2..29ef5ffa5e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -72,8 +72,8 @@ "prop-types": "15.8.1", "react": "17.0.2", "react-chartjs-2": "4.0.1", - "react-dnd": "14.0.5", - "react-dnd-html5-backend": "14.1.0", + "react-dnd": "15.1.1", + "react-dnd-html5-backend": "15.1.2", "react-dom": "17.0.2", "react-hooks-global-state": "1.0.2", "react-router-dom": "5.3.0", diff --git a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx index 7d17693989..acbdeac005 100644 --- a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx +++ b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx @@ -22,7 +22,7 @@ import { UPDATE_ENVIRONMENT, } from 'component/providers/AccessProvider/permissions'; import { useDrag, useDrop, DropTargetMonitor } from 'react-dnd'; -import { XYCoord } from 'dnd-core'; +import { XYCoord, Identifier } from 'dnd-core'; import DisabledIndicator from 'component/common/DisabledIndicator/DisabledIndicator'; import StringTruncator from 'component/common/StringTruncator/StringTruncator'; import { useHistory } from 'react-router-dom'; @@ -43,6 +43,10 @@ interface DragItem { type: string; } +interface CollectedProps { + handlerId: Identifier | null; +} + const EnvironmentListItem = ({ env, setSelectedEnv, @@ -65,7 +69,7 @@ const EnvironmentListItem = ({ }), }); - const [{ handlerId }, drop] = useDrop({ + const [{ handlerId }, drop] = useDrop({ accept: ACCEPT_TYPE, collect(monitor) { return { diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 8c29f1bb40..c237031ece 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2353,20 +2353,20 @@ schema-utils "^3.0.0" source-map "^0.7.3" -"@react-dnd/asap@^4.0.0": +"@react-dnd/asap@4.0.0": version "4.0.0" - resolved "https://registry.npmjs.org/@react-dnd/asap/-/asap-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/@react-dnd/asap/-/asap-4.0.0.tgz#b300eeed83e9801f51bd66b0337c9a6f04548651" integrity sha512-0XhqJSc6pPoNnf8DhdsPHtUhRzZALVzYMTzRwV4VI6DJNJ/5xxfL9OQUwb8IH5/2x7lSf7nAZrnzUD+16VyOVQ== -"@react-dnd/invariant@^2.0.0": - version "2.0.0" - resolved "https://registry.npmjs.org/@react-dnd/invariant/-/invariant-2.0.0.tgz" - integrity sha512-xL4RCQBCBDJ+GRwKTFhGUW8GXa4yoDfJrPbLblc3U09ciS+9ZJXJ3Qrcs/x2IODOdIE5kQxvMmE2UKyqUictUw== +"@react-dnd/invariant@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@react-dnd/invariant/-/invariant-3.0.0.tgz#ea55db612b8be3284e87b67f1a1567595cd4c386" + integrity sha512-keberJRIqPX15IK3SWS/iO1t/kGETiL1oczKrDitAaMnQ+kpHf81l3MrRmFjvfqcnApE+izEvwM6GsyoIcpsVA== -"@react-dnd/shallowequal@^2.0.0": - version "2.0.0" - resolved "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-2.0.0.tgz" - integrity sha512-Pc/AFTdwZwEKJxFJvlxrSmGe/di+aAOBn60sremrpLo6VI/6cmiUYNNwlI5KNYttg7uypzA3ILPMPgxB2GYZEg== +"@react-dnd/shallowequal@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@react-dnd/shallowequal/-/shallowequal-3.0.0.tgz#ccfe1d6eead7591b4cebf6d7fec7150eb4de1962" + integrity sha512-1ELWQdJB2UrCXTKK5cCD9uGLLIwECLIEdttKA255owdpchtXohIjZBTlFJszwYi2ZKe2Do+QvUzsGyGCMNwbdw== "@rollup/plugin-babel@^5.2.0": version "5.3.1" @@ -4967,13 +4967,13 @@ dlv@^1.1.3: resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== -dnd-core@14.0.1: - version "14.0.1" - resolved "https://registry.npmjs.org/dnd-core/-/dnd-core-14.0.1.tgz" - integrity sha512-+PVS2VPTgKFPYWo3vAFEA8WPbTf7/xo43TifH9G8S1KqnrQu0o77A3unrF5yOugy4mIz7K5wAVFHUcha7wsz6A== +dnd-core@15.1.1: + version "15.1.1" + resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-15.1.1.tgz#b4dce2d892be2a7c9ca32ffdd545350be8d52f4f" + integrity sha512-Mtj/Sltcx7stVXzeDg4g7roTe/AmzRuIf/FYOxX6F8gULbY54w066BlErBOzQfn9RIJ3gAYLGX7wvVvoBSq7ig== dependencies: - "@react-dnd/asap" "^4.0.0" - "@react-dnd/invariant" "^2.0.0" + "@react-dnd/asap" "4.0.0" + "@react-dnd/invariant" "3.0.0" redux "^4.1.1" dns-equal@^1.0.0: @@ -9215,21 +9215,21 @@ react-dev-utils@^12.0.0: strip-ansi "^6.0.1" text-table "^0.2.0" -react-dnd-html5-backend@14.1.0: - version "14.1.0" - resolved "https://registry.npmjs.org/react-dnd-html5-backend/-/react-dnd-html5-backend-14.1.0.tgz" - integrity sha512-6ONeqEC3XKVf4eVmMTe0oPds+c5B9Foyj8p/ZKLb7kL2qh9COYxiBHv3szd6gztqi/efkmriywLUVlPotqoJyw== +react-dnd-html5-backend@15.1.2: + version "15.1.2" + resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-15.1.2.tgz#85e2c5ad57e87190495756f68f44fd89299062fb" + integrity sha512-mem9QbutUF+aA2YC1y47G3ECjnYV/sCYKSnu5Jd7cbg3fLMPAwbnTf/JayYdnCH5l3eg9akD9dQt+cD0UdF8QQ== dependencies: - dnd-core "14.0.1" + dnd-core "15.1.1" -react-dnd@14.0.5: - version "14.0.5" - resolved "https://registry.npmjs.org/react-dnd/-/react-dnd-14.0.5.tgz" - integrity sha512-9i1jSgbyVw0ELlEVt/NkCUkxy1hmhJOkePoCH713u75vzHGyXhPDm28oLfc2NMSBjZRM1Y+wRjHXJT3sPrTy+A== +react-dnd@15.1.1: + version "15.1.1" + resolved "https://registry.yarnpkg.com/react-dnd/-/react-dnd-15.1.1.tgz#feb233200cb372ea6382b511baac6cc52a0068dc" + integrity sha512-QLrHtPU08U4c5zop0ANeqrHXaQw2EWLMn8DQoN6/e4eSN/UbB84P49/80Qg0MEF29VLB5vikSoiFh9N8ASNmpQ== dependencies: - "@react-dnd/invariant" "^2.0.0" - "@react-dnd/shallowequal" "^2.0.0" - dnd-core "14.0.1" + "@react-dnd/invariant" "3.0.0" + "@react-dnd/shallowequal" "3.0.0" + dnd-core "15.1.1" fast-deep-equal "^3.1.3" hoist-non-react-statics "^3.3.2"