Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove lodash #924

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@tanstack/react-query-persist-client": "5.22.2",
"@wagmi/core": "2.13.3",
"calendar-link": "^2.2.0",
"dequal": "2.0.3",
"dns-packet": "^5.4.0",
"graphql-request": "5.1.0",
"i18next": "^21.9.1",
Expand All @@ -80,7 +81,6 @@
"immer": "^9.0.15",
"intl-segmenter-polyfill": "^0.4.4",
"iso-639-1": "^2.1.15",
"lodash": "^4.17.21",
"markdown-to-jsx": "^7.1.7",
"next": "13.5.6",
"node-fetch": "^3.3.2",
Expand Down
7 changes: 4 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/@molecules/BurnFuses/BurnFusesContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isEqual from 'lodash/isEqual'
import { dequal as isEqual } from 'dequal'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'
Expand Down
14 changes: 13 additions & 1 deletion src/components/@molecules/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { QueryClient, useQueryClient } from '@tanstack/react-query'
import debounce from 'lodash/debounce'
import {
Dispatch,
RefObject,
Expand Down Expand Up @@ -628,6 +627,19 @@ const useBuildDropdownItems = (inputVal: string, history: HistoryItem[]) => {
)
}

const debounce = (func: (...args: any[]) => void, delay?: number) => {
let timerId: NodeJS.Timeout
let shouldInvoke: boolean

return (...args: any[]) => {
shouldInvoke = true

clearTimeout(timerId)

timerId = setTimeout(() => shouldInvoke && func(...args), delay)
}
}

const debouncer = debounce((setFunc: () => void) => setFunc(), 250)

export const SearchInput = ({ size = 'extraLarge' }: { size?: 'medium' | 'extraLarge' }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/abilities/useAbilities.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { mockFunction, renderHook } from '@app/test-utils'

import * as _ from 'lodash'
import { match, P } from 'ts-pattern'
import { Address } from 'viem'
// import { writeFileSync} from 'fs'
Expand All @@ -21,6 +20,7 @@ import { useBasicName } from '../useBasicName'
import { useHasSubnames } from '../useHasSubnames'
import { useParentBasicName } from '../useParentBasicName'
import { useAbilities } from './useAbilities'
import { dequal } from 'dequal'

vi.mock('@app/hooks/account/useAccountSafely')
vi.mock('@app/hooks/useBasicName')
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('useAbilities', () => {

const { result } = renderHook(() => useAbilities({ name }))

let index = group.findIndex(([, item]) => _.isEqual(item, result.current.data))
let index = group.findIndex(([, item]) => dequal(item, result.current.data))
if (index == -1) group.push([[type], result.current.data])
else group[index][0].push(type)

Expand Down
Loading