refactor: replace lazy loading feature with domMax in LazyMotion components

- Removed the framer-lazy-feature module and updated LazyMotion components in both landing and dashboard providers to use domMax directly.
- This change simplifies the feature loading process and improves performance by eliminating unnecessary imports.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-12-05 00:41:16 +08:00
parent 20da96018d
commit b28b03c40b
3 changed files with 4 additions and 8 deletions

View File

@@ -1 +0,0 @@
export { domMax as default } from 'motion/react'

View File

@@ -1,17 +1,15 @@
'use client'
import { QueryClientProvider } from '@tanstack/react-query'
import { LazyMotion } from 'motion/react'
import { domMax, LazyMotion } from 'motion/react'
import type { JSX, PropsWithChildren } from 'react'
import { ProviderComposer } from '../../components/common/ProviderComposer'
import { queryClient } from '../../lib/query-client'
const loadFeatures = () =>
import('./framer-lazy-feature').then((res) => res.default)
const contexts: JSX.Element[] = [
<QueryClientProvider key="queryClient" client={queryClient} />,
<LazyMotion features={loadFeatures} strict key="framer" />,
<LazyMotion features={domMax} strict key="framer" />,
]
export function Providers({ children }: PropsWithChildren) {

View File

@@ -3,7 +3,7 @@ import { Toaster } from '@afilmory/ui/sonner.jsx'
import { Spring } from '@afilmory/utils'
import { QueryClientProvider } from '@tanstack/react-query'
import { Provider } from 'jotai'
import { LazyMotion, MotionConfig } from 'motion/react'
import { domMax, LazyMotion, MotionConfig } from 'motion/react'
import type { FC, PropsWithChildren } from 'react'
import { jotaiStore } from '~/lib/jotai'
@@ -14,9 +14,8 @@ import { EventProvider } from './event-provider'
import { I18nProvider } from './i18n-provider'
import { StableRouterProvider } from './stable-router-provider'
const loadFeatures = () => import('../framer-lazy-feature').then((res) => res.default)
export const RootProviders: FC<PropsWithChildren> = ({ children }) => (
<LazyMotion features={loadFeatures} strict>
<LazyMotion features={domMax} strict>
<MotionConfig transition={Spring.presets.smooth}>
<QueryClientProvider client={queryClient}>
<Provider store={jotaiStore}>