Skip to content

Commit e4651c7

Browse files
fix: npm stats - update react-pacer (#404)
* use react-pacer * use callbacks for throttling --------- Co-authored-by: Kevin Van Cott <[email protected]>
1 parent 4f77ee6 commit e4651c7

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
"@sentry/react": "^8.35.0",
3333
"@sentry/vite-plugin": "^2.22.6",
3434
"@tailwindcss/typography": "^0.5.13",
35-
"@tanstack/pacer": "^0.2.0",
36-
"@tanstack/react-pacer": "^0.2.0",
35+
"@tanstack/react-pacer": "^0.7.0",
3736
"@tanstack/react-query": "^5.66.0",
3837
"@tanstack/react-router": "1.121.0-alpha.11",
3938
"@tanstack/react-router-devtools": "1.121.0-alpha.11",

pnpm-lock.yaml

Lines changed: 9 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/stats/npm/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as React from 'react'
22
import { Link } from '@tanstack/react-router'
33
import { z } from 'zod'
4-
import { throttle } from '@tanstack/pacer'
5-
import { useDebouncedValue } from '@tanstack/react-pacer'
4+
import { useDebouncedValue, useThrottledCallback } from '@tanstack/react-pacer'
65
import {
76
MdClose,
87
MdVisibility,
@@ -1142,7 +1141,7 @@ function RouteComponent() {
11421141
setColorPickerPackage(packageName)
11431142
}
11441143

1145-
const handleColorChange = throttle(
1144+
const handleColorChange = useThrottledCallback(
11461145
(packageName: string, color: string | null) => {
11471146
navigate({
11481147
to: '.',
@@ -1174,7 +1173,7 @@ function RouteComponent() {
11741173
}
11751174
)
11761175

1177-
const onHeightChange = throttle(
1176+
const onHeightChange = useThrottledCallback(
11781177
(height: number) => {
11791178
navigate({
11801179
to: '.',

0 commit comments

Comments
 (0)