diff --git a/src/pages/components/editor.tsx b/src/pages/components/editor.tsx index 843e10a..42733a6 100644 --- a/src/pages/components/editor.tsx +++ b/src/pages/components/editor.tsx @@ -17,6 +17,7 @@ import { LangList } from '../../locales'; import { useGlobal } from '../../recoil'; import type { L7EditorProps } from '../../types'; import useStyle from './styles'; +import { useUpdateEffect } from 'ahooks'; type EditorProps = L7EditorProps; @@ -26,7 +27,7 @@ export const Editor: React.FC = (props) => { const { theme, mapOptions, setMapOptions, showIndex, locale } = useGlobal(); const styles = useStyle(); - useEffect(() => { + useUpdateEffect(() => { if (theme === 'dark') { setMapOptions({ ...mapOptions, style: 'dark' }); } else {