Skip to content

Commit

Permalink
fix: maybe fix framer bug
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 7, 2023
1 parent 06edd77 commit 99b36ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/components/layout/header/internal/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useActivity,
} from '~/atoms/activity'
import { FloatPopover } from '~/components/ui/float-popover'
import useDebounceValue from '~/hooks/common/use-debounce-value'
import { apiClient } from '~/lib/request'
import { useAggregationSelector } from '~/providers/root/aggregation-data-provider'

Expand Down Expand Up @@ -99,15 +100,15 @@ export function Activity() {

const ownerName = useAggregationSelector((data) => data.user.name)
const memoProcessName = useMemo(
() => ({ processName: data?.processName || '' }),
[data?.processName],
() => ({ processName: activity?.processName || '' }),
[activity?.processName],
)
if (!data) {
return null
}

const { processName, media } = activity
if (!appLabels[processName]) {
console.log('Not collected process name: ', processName)
const debounceProcess = useDebounceValue(processName, 300)

if (!appLabels[debounceProcess]) {
console.log('Not collected process name: ', debounceProcess)
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
import { AnimatePresence, m } from 'framer-motion'

import { microdampingPreset } from '~/constants/spring'
import useDebounceValue from '~/hooks/common/use-debounce-value'

export const NumberSmoothTransition = (props: {
children: string | number
}) => {
const { children } = props
const debouncedChildren = useDebounceValue(children, 300)
return (
<AnimatePresence mode="popLayout">
<AnimatePresence mode="popLayout" initial={false}>
<m.span
key={children}
key={debouncedChildren}
initial={{
opacity: 0,
y: -16,
Expand All @@ -23,10 +25,11 @@ export const NumberSmoothTransition = (props: {
exit={{
opacity: 0,
y: -16,
position: 'absolute',
}}
transition={microdampingPreset}
>
{children}
{debouncedChildren}
</m.span>
</AnimatePresence>
)
Expand Down

1 comment on commit 99b36ce

@vercel
Copy link

@vercel vercel bot commented on 99b36ce Jul 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-innei.vercel.app
shiro-git-main-innei.vercel.app
springtide.vercel.app
innei.in

Please sign in to comment.