diff --git a/Elements/Button.tsx b/Elements/Button.tsx index 4fb8d42..d52a7d1 100644 --- a/Elements/Button.tsx +++ b/Elements/Button.tsx @@ -1,6 +1,6 @@ import { Button as AntButton } from 'antd'; import type { BaseButtonProps } from 'antd/lib/button/button'; -import { throttle } from 'lodash-es'; +import { throttle } from 'radash/dist/curry'; import type { FC } from 'react'; import type { BaseElementProps } from './types'; @@ -17,9 +17,12 @@ export default (function Button({ text, ...props }: BaseElementProps & ElementProps) { - const throttledAction = throttle(action, 1200, { - trailing: false, - }); + const throttledAction = throttle( + { + interval: 1200, + }, + action + ); return ( objectUseFor.label.toLowerCase(), - ['asc'] + 'asc' ), radioInfuranceOPF: [ diff --git a/jest.config.js b/jest.config.js index 86e9814..67ec1da 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,7 +16,6 @@ const customJestConfig = { moduleDirectories: ['node_modules', '/'], moduleNameMapper: { // Handle module aliases (this will be automatically configured for you soon) - 'lodash-es': 'lodash', }, testEnvironment: 'jest-environment-jsdom', preset: 'ts-jest', diff --git a/next.config.js b/next.config.js index c2b6875..5b1a338 100644 --- a/next.config.js +++ b/next.config.js @@ -16,14 +16,6 @@ const nextConfig = { styledComponents: true, }, pageExtensions: ['tsx', 'jsx'], - experimental: { - modularizeImports: { - 'lodash-es': { - transform: 'lodash-es/{{member}}', - preventFullImport: true, - }, - }, - }, rewrites: process.env.NODE_ENV === 'development' && async function rewrites() { diff --git a/package.json b/package.json index d3cf77b..583e807 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "graphql": "^16.6.0", "less": "^4.1.2", "less-loader": "^10.2.0", - "lodash-es": "^4.17.21", "mobx": "^6.5.0", "mobx-react-lite": "^3.4.0", "next": "^12.3.0", @@ -35,6 +34,7 @@ "next-plugin-graphql": "^0.0.2", "next-with-less": "^2.0.5", "normalize.css": "^8.0.1", + "radash": "^7.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "rebass": "^4.0.7", @@ -49,7 +49,6 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^14.4.3", - "@types/lodash-es": "^4.17.6", "@types/node": "18.7.18", "@types/react": "18.0.20", "@types/react-dom": "18.0.6", diff --git a/stores/calculation/options/index.ts b/stores/calculation/options/index.ts index cfb4f26..032115f 100644 --- a/stores/calculation/options/index.ts +++ b/stores/calculation/options/index.ts @@ -3,7 +3,6 @@ import type { Elements, ElementsTypes } from 'Components/Calculation/config/map/values'; import defaultOptions from 'config/default-options'; import type { BaseOption } from 'Elements/types'; -import { merge } from 'lodash-es'; import { makeAutoObservable } from 'mobx'; import type RootStore from 'stores/root'; import type { CalculationOptions } from './types'; @@ -18,7 +17,7 @@ export default class OptionsStore { } hydrate = (initialOptions: CalculationOptions) => { - this.options = merge(defaultOptions, initialOptions); + this.options = { ...defaultOptions, ...initialOptions }; }; getOptions(elementName: T) { diff --git a/yarn.lock b/yarn.lock index f420957..3d1aa7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2284,18 +2284,6 @@ dependencies: "@types/node" "*" -"@types/lodash-es@^4.17.6": - version "4.17.6" - resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.6.tgz#c2ed4c8320ffa6f11b43eb89e9eaeec65966a0a0" - integrity sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg== - dependencies: - "@types/lodash" "*" - -"@types/lodash@*": - version "4.14.182" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2" - integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q== - "@types/node-fetch@^2.5.10": version "2.6.1" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975" @@ -6768,11 +6756,6 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash-es@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" - integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== - lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"