Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Replace lodash.throttle with throttle-debounce (#1322)

sarayourfriend787f7b785bcb
diff --git a/package.json b/package.json
index 397323ef0..52aab3971 100644
--- a/package.json
+++ b/package.json
@@ -82,16 +82,15 @@
"focus-visible": "^5.2.0",
"glob": "^7.1.6",
"lodash.clonedeep": "^4.5.0",
- "lodash.debounce": "^4.0.8",
"lodash.isempty": "^4.4.0",
"lodash.sortby": "^4.7.0",
- "lodash.throttle": "^4.1.1",
"node-html-parser": "^5.3.3",
"nuxt": "^2.15.4",
"pinia": "^2.0.13",
"postcss-focus-visible": "^6.0.4",
"reakit-utils": "^0.15.2",
"seeded-rand": "^2.0.1",
+ "throttle-debounce": "^4.0.1",
"uuid": "^8.3.2",
"vue-i18n": "^8.26.7"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3c931c4ef..aa3fabb38 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -65,10 +65,8 @@ specifiers:
jest-transform-stub: ^2.0.0
lint-staged: ^12.3.7
lodash.clonedeep: ^4.5.0
- lodash.debounce: ^4.0.8
lodash.isempty: ^4.4.0
lodash.sortby: ^4.7.0
- lodash.throttle: ^4.1.1
module-alias: ^2.2.2
node-html-parser: ^5.3.3
npm-run-all: ^4.1.5
@@ -86,6 +84,7 @@ specifiers:
tailwindcss: ^3.0.23
tailwindcss-rtl: ^0.9.0
talkback: ^3.0.1
+ throttle-debounce: ^4.0.1
ts-node: ^10.7.0
typescript: ^4.6.2
uuid: ^8.3.2
@@ -122,16 +121,15 @@ dependencies:
focus-visible: 5.2.0
glob: 7.2.0
lodash.clonedeep: 4.5.0
- lodash.debounce: 4.0.8
lodash.isempty: 4.4.0
lodash.sortby: 4.7.0
- lodash.throttle: 4.1.1
node-html-parser: 5.3.3
postcss-focus-visible: [email protected]
reakit-utils: 0.15.2
seeded-rand: 2.0.1
+ throttle-debounce: 4.0.1
uuid: 8.3.2
vue-i18n: 8.26.7
@@ -12735,10 +12733,6 @@ packages:
dependencies:
lodash._reinterpolate: 3.0.0
- /lodash.throttle/4.1.1:
- resolution: {integrity: sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=}
- dev: false
-
/lodash.unionby/4.8.0:
resolution: {integrity: sha1-iD8Jj/ePVkpye3UI4JzdU5c0u4M=}
dev: false
@@ -17452,6 +17446,11 @@ packages:
engines: {node: '>=10'}
dev: true
+ /throttle-debounce/4.0.1:
+ resolution: {integrity: sha512-s3PedbXdZtr8v3J5Sxd5T/GmWG80BcK5GVpwDdvgEaUXsaMqQe4zxgmC4TA7B8luSDCPxo3CeSBS3F9rF1CZwg==}
+ engines: {node: '>=12.22'}
+ dev: false
+
/through/2.3.8:
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
diff --git a/src/composables/use-scroll.js b/src/composables/use-scroll.js
index bf755ce7d..6907c1bcb 100644
--- a/src/composables/use-scroll.js
+++ b/src/composables/use-scroll.js
@@ -1,5 +1,5 @@
// code taken from Vueuse
-import throttle from 'lodash.throttle'
+import { throttle } from 'throttle-debounce'
import { ref } from '@nuxtjs/composition-api'
import { useEventListener } from '~/composables/use-event-listener'
@@ -31,7 +31,7 @@ export function useScroll(element, { throttleMs = 200 } = {}) {
}
const handler = throttleMs
- ? throttle(scrollHandler, throttleMs)
+ ? throttle(throttleMs, scrollHandler)
: scrollHandler
useEventListener(element, 'scroll', handler, {
diff --git a/src/composables/use-window-scroll.js b/src/composables/use-window-scroll.js
index 318d8b179..b4fbe6052 100644
--- a/src/composables/use-window-scroll.js
+++ b/src/composables/use-window-scroll.js
@@ -1,5 +1,5 @@
// code taken from Vueuse
-import throttle from 'lodash.throttle'
+import { throttle } from 'throttle-debounce'
import { ref } from '@nuxtjs/composition-api'
import { defaultWindow } from '~/constants/window'
@@ -44,7 +44,7 @@ export function useWindowScroll({
}
const handler = throttleMs
- ? throttle(scrollHandler, throttleMs)
+ ? throttle(throttleMs, scrollHandler)
: scrollHandler
useEventListener(window, 'scroll', handler, {