From b28b03c40becb0ecd37cfee41035766724c5f161 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 5 Dec 2025 00:41:16 +0800 Subject: [PATCH] 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 --- apps/landing/src/providers/root/framer-lazy-feature.ts | 1 - apps/landing/src/providers/root/index.tsx | 6 ++---- be/apps/dashboard/src/providers/root-providers.tsx | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 apps/landing/src/providers/root/framer-lazy-feature.ts diff --git a/apps/landing/src/providers/root/framer-lazy-feature.ts b/apps/landing/src/providers/root/framer-lazy-feature.ts deleted file mode 100644 index 7f7246c5..00000000 --- a/apps/landing/src/providers/root/framer-lazy-feature.ts +++ /dev/null @@ -1 +0,0 @@ -export { domMax as default } from 'motion/react' diff --git a/apps/landing/src/providers/root/index.tsx b/apps/landing/src/providers/root/index.tsx index 60df21ad..2d1678bf 100644 --- a/apps/landing/src/providers/root/index.tsx +++ b/apps/landing/src/providers/root/index.tsx @@ -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[] = [ , - , + , ] export function Providers({ children }: PropsWithChildren) { diff --git a/be/apps/dashboard/src/providers/root-providers.tsx b/be/apps/dashboard/src/providers/root-providers.tsx index 700151e0..2f1150bc 100644 --- a/be/apps/dashboard/src/providers/root-providers.tsx +++ b/be/apps/dashboard/src/providers/root-providers.tsx @@ -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 = ({ children }) => ( - +