There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
build: lazy load `lottie-web` (#1622)
Himself6545761f02508b
diff --git a/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx b/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsxindex ba1a9904a3..fdcbfc4d7b 100644--- a/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx+++ b/apps/web/src/components/blocksuite/header/editor-mode-switch/CustomLottie.tsx@@ -1,7 +1,9 @@-import lottie from 'lottie-web';+import { atom, useAtomValue } from 'jotai';import type { FC } from 'react';import { useEffect, useRef } from 'react';+const lottieAtom = atom(async () => import('lottie-web').then(m => m.default));+type CustomLottieProps = {options: {loop?: boolean | number | undefined;@@ -26,6 +28,7 @@ const CustomLottie: FC<CustomLottieProps> = ({}) => {const element = useRef<HTMLDivElement>(null);const lottieInstance = useRef<any>();+ const lottie = useAtomValue(lottieAtom);useEffect(() => {if (element.current) {@@ -37,7 +40,7 @@ const CustomLottie: FC<CustomLottieProps> = ({return () => {lottieInstance.current?.destroy();};- }, [options]);+ }, [lottie, options]);useEffect(() => {if (speed) {