File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
useActivity ,
13
13
} from '~/atoms/activity'
14
14
import { FloatPopover } from '~/components/ui/float-popover'
15
+ import useDebounceValue from '~/hooks/common/use-debounce-value'
15
16
import { apiClient } from '~/lib/request'
16
17
import { useAggregationSelector } from '~/providers/root/aggregation-data-provider'
17
18
@@ -99,15 +100,15 @@ export function Activity() {
99
100
100
101
const ownerName = useAggregationSelector ( ( data ) => data . user . name )
101
102
const memoProcessName = useMemo (
102
- ( ) => ( { processName : data ?. processName || '' } ) ,
103
- [ data ?. processName ] ,
103
+ ( ) => ( { processName : activity ?. processName || '' } ) ,
104
+ [ activity ?. processName ] ,
104
105
)
105
- if ( ! data ) {
106
- return null
107
- }
106
+
108
107
const { processName, media } = activity
109
- if ( ! appLabels [ processName ] ) {
110
- console . log ( 'Not collected process name: ' , processName )
108
+ const debounceProcess = useDebounceValue ( processName , 300 )
109
+
110
+ if ( ! appLabels [ debounceProcess ] ) {
111
+ console . log ( 'Not collected process name: ' , debounceProcess )
111
112
}
112
113
113
114
return (
Original file line number Diff line number Diff line change 3
3
import { AnimatePresence , m } from 'framer-motion'
4
4
5
5
import { microdampingPreset } from '~/constants/spring'
6
+ import useDebounceValue from '~/hooks/common/use-debounce-value'
6
7
7
8
export const NumberSmoothTransition = ( props : {
8
9
children : string | number
9
10
} ) => {
10
11
const { children } = props
12
+ const debouncedChildren = useDebounceValue ( children , 300 )
11
13
return (
12
- < AnimatePresence mode = "popLayout" >
14
+ < AnimatePresence mode = "popLayout" initial = { false } >
13
15
< m . span
14
- key = { children }
16
+ key = { debouncedChildren }
15
17
initial = { {
16
18
opacity : 0 ,
17
19
y : - 16 ,
@@ -23,10 +25,11 @@ export const NumberSmoothTransition = (props: {
23
25
exit = { {
24
26
opacity : 0 ,
25
27
y : - 16 ,
28
+ position : 'absolute' ,
26
29
} }
27
30
transition = { microdampingPreset }
28
31
>
29
- { children }
32
+ { debouncedChildren }
30
33
</ m . span >
31
34
</ AnimatePresence >
32
35
)
You can’t perform that action at this time.
0 commit comments