Skip to content

Commit

Permalink
fix: downgrade framer motion
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Mar 21, 2024
1 parent 1117a39 commit daa50a1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"emoji-mart": "5.5.2",
"emoji-picker-react": "4.9.2",
"foxact": "0.2.33",
"framer-motion": "^11.0.18",
"framer-motion": "11.0.8",
"fuse.js": "7.0.0",
"idb-keyval": "6.2.1",
"immer": "^10.0.4",
Expand Down
27 changes: 20 additions & 7 deletions pnpm-lock.yaml

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

17 changes: 7 additions & 10 deletions src/components/ui/transition/factor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { forwardRef, memo, useMemo } from 'react'
import { forwardRef, memo, useState } from 'react'
import { m } from 'framer-motion'
import type {
HTMLMotionProps,
Expand Down Expand Up @@ -49,17 +49,14 @@ export const createTransitionView = (params: TransitionViewParams) => {
HTMLMotionProps<any> & RefAttributes<HTMLElement>
>

const [stableIsHydrationEnded] = useState(isHydrationEnded)
if (lcpOptimization && !stableIsHydrationEnded) {
return <div>{props.children}</div>
}

return (
<MotionComponent
initial={useMemo(
() =>
lcpOptimization
? isHydrationEnded()
? initial || from
: true
: initial || from,
[],
)}
initial={initial || from}
ref={ref}
animate={{
...to,
Expand Down

0 comments on commit daa50a1

Please sign in to comment.