diff --git a/web/cashtab/package-lock.json b/web/cashtab/package-lock.json --- a/web/cashtab/package-lock.json +++ b/web/cashtab/package-lock.json @@ -18,7 +18,8 @@ "ethereum-blockies-base64": "^1.0.2", "fbt": "^0.16.4", "localforage": "^1.9.0", - "lodash": "^4.17.20", + "lodash.isempty": "^4.4.0", + "lodash.isequal": "^4.5.0", "qrcode.react": "^1.0.0", "react": "^17.0.1", "react-app-polyfill": "^2.0.0", @@ -15250,6 +15251,16 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.isempty": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "node_modules/lodash.memoize": { "version": "4.1.2", "dev": true, @@ -38642,6 +38653,16 @@ "version": "4.4.2", "dev": true }, + "lodash.isempty": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=" + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "lodash.memoize": { "version": "4.1.2", "dev": true diff --git a/web/cashtab/package.json b/web/cashtab/package.json --- a/web/cashtab/package.json +++ b/web/cashtab/package.json @@ -15,7 +15,8 @@ "ethereum-blockies-base64": "^1.0.2", "fbt": "^0.16.4", "localforage": "^1.9.0", - "lodash": "^4.17.20", + "lodash.isempty": "^4.4.0", + "lodash.isequal": "^4.5.0", "qrcode.react": "^1.0.0", "react": "^17.0.1", "react-app-polyfill": "^2.0.0", diff --git a/web/cashtab/src/hooks/useWallet.js b/web/cashtab/src/hooks/useWallet.js --- a/web/cashtab/src/hooks/useWallet.js +++ b/web/cashtab/src/hooks/useWallet.js @@ -14,7 +14,8 @@ } from '@utils/cashMethods'; import localforage from 'localforage'; import { currency } from '@components/Common/Ticker'; -import _ from 'lodash'; +import isEmpty from 'lodash.isempty'; +import isEqual from 'lodash.isequal'; const useWallet = () => { const [wallet, setWallet] = useState(false); @@ -183,7 +184,7 @@ } // Compare utxo sets - const utxoArraysUnchanged = _.isEqual(utxos, previousUtxosToCompare); + const utxoArraysUnchanged = isEqual(utxos, previousUtxosToCompare); // If utxos are not the same as previousUtxos if (utxoArraysUnchanged) { @@ -212,7 +213,7 @@ const utxos = await getUtxos(BCH, cashAddresses); // If an error is returned or utxos from only 1 address are returned - if (!utxos || _.isEmpty(utxos) || utxos.error || utxos.length < 2) { + if (!utxos || isEmpty(utxos) || utxos.error || utxos.length < 2) { // Throw error here to prevent more attempted api calls // as you are likely already at rate limits throw new Error('Error fetching utxos');