Skip to content

Commit

Permalink
Remove lodash dependency (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
wirednkod authored Jan 26, 2024
1 parent 0374231 commit 8249490
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@
"@polkadot/keyring": "^12.6.2",
"@polkadot/react-hooks": "^0.39.1",
"@polkadot/util": "^12.6.2",
"@types/lodash.throttle": "^4.1.9",
"bignumber.js": "^9.1.2",
"buffer": "^6.0.3",
"date-fns": "^3.3.1",
"framer-motion": "^10.18.0",
"i18next": "^23.7.19",
"i18next-browser-languagedetector": "^7.2.0",
"lodash.throttle": "^4.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
Expand Down
22 changes: 1 addition & 21 deletions src/library/SideMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

import { faCompressAlt, faExpandAlt } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import throttle from "lodash.throttle"
import { useEffect, useRef } from "react"
import { useRef } from "react"
import { useTranslation } from "react-i18next"
import { SideMenuStickyThreshold } from "consts"
import { useHelp } from "contexts/Help"
import { useTheme } from "contexts/Themes"
import { useUi } from "contexts/UI"
Expand Down Expand Up @@ -35,24 +33,6 @@ export const SideMenu = () => {
}: UIContextInterface = useUi()
const { openHelp } = useHelp()

// listen to window resize to hide SideMenu
useEffect(() => {
window.addEventListener("resize", windowThrottle)
return () => {
window.removeEventListener("resize", windowThrottle)
}
}, [])

const throttleCallback = () => {
if (window.innerWidth >= SideMenuStickyThreshold) {
setSideMenu(false)
}
}
const windowThrottle = throttle(throttleCallback, 200, {
trailing: true,
leading: false,
})

const ref = useRef(null)
useOutsideAlerter(ref, () => {
setSideMenu(false)
Expand Down
17 changes: 0 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1587,18 +1587,6 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==

"@types/lodash.throttle@^4.1.9":
version "4.1.9"
resolved "https://registry.yarnpkg.com/@types/lodash.throttle/-/lodash.throttle-4.1.9.tgz#f17a6ae084f7c0117bd7df145b379537bc9615c5"
integrity sha512-PCPVfpfueguWZQB7pJQK890F2scYKoDUL3iM522AptHWn7d5NQmeS/LTEHIcLr5PaTzl3dK2Z0xSUHHTHwaL5g==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.196"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.196.tgz#a7c3d6fc52d8d71328b764e28e080b4169ec7a95"
integrity sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ==

"@types/mdast@^3.0.0":
version "3.0.15"
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.15.tgz#49c524a263f30ffa28b71ae282f813ed000ab9f5"
Expand Down Expand Up @@ -4510,11 +4498,6 @@ lodash.pick@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
integrity sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==

lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==

longest-streak@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-3.1.0.tgz#62fa67cd958742a1574af9f39866364102d90cd4"
Expand Down

0 comments on commit 8249490

Please sign in to comment.