diff --git a/package.json b/package.json index bf2b7a498..adb9c3044 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,13 @@ "buffer": "6.0.3", "classnames": "2.5.1", "eventemitter3": "5.0.1", + "fast-equals": "^6.0.0", "filter-invalid-dom-props": "3.0.1", "hat": "^0.0.3", "i18next": "^24.0.5", "langs": "github:Stremio/nodejs-langs", "lodash.debounce": "4.0.8", "lodash.intersection": "4.4.0", - "lodash.isequal": "4.5.0", "lodash.throttle": "4.1.1", "magnet-uri": "6.2.0", "prop-types": "15.8.1", @@ -53,7 +53,6 @@ "@stylistic/eslint-plugin": "^5.4.0", "@stylistic/eslint-plugin-jsx": "^4.4.1", "@types/hat": "^0.0.4", - "@types/lodash.isequal": "^4.5.8", "@types/lodash.throttle": "^4.1.9", "@types/react": "^18.3.13", "@types/react-dom": "^18.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95b44e9e2..aebe75436 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,9 @@ importers: eventemitter3: specifier: 5.0.1 version: 5.0.1 + fast-equals: + specifier: ^6.0.0 + version: 6.0.0 filter-invalid-dom-props: specifier: 3.0.1 version: 3.0.1 @@ -59,9 +62,6 @@ importers: lodash.intersection: specifier: 4.4.0 version: 4.4.0 - lodash.isequal: - specifier: 4.5.0 - version: 4.5.0 lodash.throttle: specifier: 4.1.1 version: 4.1.1 @@ -120,9 +120,6 @@ importers: '@types/hat': specifier: ^0.0.4 version: 0.0.4 - '@types/lodash.isequal': - specifier: ^4.5.8 - version: 4.5.8 '@types/lodash.throttle': specifier: ^4.1.9 version: 4.1.9 @@ -1401,9 +1398,6 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/lodash.isequal@4.5.8': - resolution: {integrity: sha512-uput6pg4E/tj2LGxCZo9+y27JNyB2OZuuI/T5F+ylVDYuqICLG2/ktjxx0v6GvVntAf8TvEzeQLcV0ffRirXuA==} - '@types/lodash.throttle@4.1.9': resolution: {integrity: sha512-PCPVfpfueguWZQB7pJQK890F2scYKoDUL3iM522AptHWn7d5NQmeS/LTEHIcLr5PaTzl3dK2Z0xSUHHTHwaL5g==} @@ -2502,6 +2496,10 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-equals@6.0.0: + resolution: {integrity: sha512-PFhhIGgdM79r5Uztdj9Zb6Tt1zKafqVfdMGwVca1z5z6fbX7DmsySSuJd8HiP6I1j505DCS83cLxo5rmSNeVEA==} + engines: {node: '>=6.0.0'} + fast-glob@3.3.3: resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} @@ -3402,10 +3400,6 @@ packages: lodash.intersection@4.4.0: resolution: {integrity: sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==} - lodash.isequal@4.5.0: - resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} - deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. - lodash.memoize@4.1.2: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} @@ -6706,10 +6700,6 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/lodash.isequal@4.5.8': - dependencies: - '@types/lodash': 4.17.20 - '@types/lodash.throttle@4.1.9': dependencies: '@types/lodash': 4.17.20 @@ -8091,6 +8081,8 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-equals@6.0.0: {} + fast-glob@3.3.3: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -9174,8 +9166,6 @@ snapshots: lodash.intersection@4.4.0: {} - lodash.isequal@4.5.0: {} - lodash.memoize@4.1.2: {} lodash.merge@4.6.2: {} diff --git a/src/App/SearchParamsHandler.js b/src/App/SearchParamsHandler.js index 8834e6e0c..86f10d0c4 100644 --- a/src/App/SearchParamsHandler.js +++ b/src/App/SearchParamsHandler.js @@ -1,7 +1,7 @@ // Copyright (C) 2017-2023 Smart code 203358507 const React = require('react'); -const isEqual = require('lodash.isequal'); +const { deepEqual } = require('fast-equals'); const { withCoreSuspender, useProfile, useToast } = require('stremio/common'); const { useServices } = require('stremio/services'); @@ -18,7 +18,7 @@ const SearchParamsHandler = () => { setSearchParams((previousSearchParams) => { const currentSearchParams = Object.fromEntries(searchParams.entries()); - return isEqual(previousSearchParams, currentSearchParams) ? previousSearchParams : currentSearchParams; + return deepEqual(previousSearchParams, currentSearchParams) ? previousSearchParams : currentSearchParams; }); }; diff --git a/src/common/useModelState.js b/src/common/useModelState.js index 42672dc22..da637b8ff 100644 --- a/src/common/useModelState.js +++ b/src/common/useModelState.js @@ -2,7 +2,7 @@ const React = require('react'); const throttle = require('lodash.throttle'); -const isEqual = require('lodash.isequal'); +const { deepEqual } = require('fast-equals'); const intersection = require('lodash.intersection'); const { useCoreSuspender } = require('stremio/common/CoreSuspender'); const { useRouteFocused } = require('stremio-router'); @@ -19,7 +19,7 @@ const useModelState = ({ action, ...args }) => { const [state, setState] = React.useReducer( (prevState, nextState) => { return Object.keys(prevState).reduce((result, key) => { - result[key] = isEqual(prevState[key], nextState[key]) ? prevState[key] : nextState[key]; + result[key] = deepEqual(prevState[key], nextState[key]) ? prevState[key] : nextState[key]; return result; }, {}); }, diff --git a/src/router/Router/Router.js b/src/router/Router/Router.js index db4c9e957..2c7830bc3 100644 --- a/src/router/Router/Router.js +++ b/src/router/Router/Router.js @@ -5,7 +5,7 @@ const ReactIs = require('react-is'); const PropTypes = require('prop-types'); const classnames = require('classnames'); const UrlUtils = require('url'); -const isEqual = require('lodash.isequal'); +const { deepEqual } = require('fast-equals'); const { RouteFocusedProvider } = require('../RouteFocusedContext'); const Route = require('../Route'); const routeConfigForPath = require('./routeConfigForPath'); @@ -54,11 +54,11 @@ const Router = ({ className, onPathNotMatch, onRouteChange, ...props }) => { return { key: `${routeViewIndex}${routeIndex}`, component: routeConfig.component, - urlParams: view !== null && isEqual(view.urlParams, urlParams) ? + urlParams: view !== null && deepEqual(view.urlParams, urlParams) ? view.urlParams : urlParams, - queryParams: view !== null && isEqual(Array.from(view.queryParams.entries()), Array.from(queryParams.entries())) ? + queryParams: view !== null && deepEqual(Array.from(view.queryParams.entries()), Array.from(queryParams.entries())) ? view.queryParams : queryParams diff --git a/src/routes/Settings/Streaming/useStreamingOptions.ts b/src/routes/Settings/Streaming/useStreamingOptions.ts index 140909132..0e22afc0b 100644 --- a/src/routes/Settings/Streaming/useStreamingOptions.ts +++ b/src/routes/Settings/Streaming/useStreamingOptions.ts @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import isEqual from 'lodash.isequal'; +import { deepEqual } from 'fast-equals'; import { useServices } from 'stremio/services'; const CACHE_SIZES = [0, 2147483648, 5368709120, 10737418240, null]; @@ -160,7 +160,7 @@ const useStreamingOptions = (streamingServer: StreamingServer) => { btRequestTimeout: settings.btRequestTimeout }; const isCustomTorrentProfileSelected = Object.values(TORRENT_PROFILES).every((torrentProfile) => { - return !isEqual(torrentProfile, selectedTorrentProfile); + return !deepEqual(torrentProfile, selectedTorrentProfile); }); return { options: Object.keys(TORRENT_PROFILES)