@blocklet/pages-kit-block-studio 0.6.103 → 0.6.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  import { createAuthServiceSessionContext } from '@arcblock/did-connect-react/lib/Session';
9
9
  import { useConfig } from '@arcblock/ux/lib/Config';
10
10
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
11
+ import { useDeepCompareMemo } from '@blocklet/pages-kit/hooks/use-deep-compare-memo';
11
12
  import Toast, { ToastProvider } from '@arcblock/ux/lib/Toast';
12
13
  import { createAxios } from '@blocklet/js-sdk';
13
14
  import { PagesKitThemeProvider } from '@blocklet/pages-kit-inner-components/theme';
@@ -31,8 +32,7 @@ import PhoneAndroidIcon from '@mui/icons-material/PhoneAndroid';
31
32
  import SettingsIcon from '@mui/icons-material/Settings';
32
33
  import SortByAlphaIcon from '@mui/icons-material/SortByAlpha';
33
34
  import { Alert, Box, Button, CircularProgress, Dialog, DialogContent, DialogTitle, IconButton, List, ListItem, ListItemButton, Skeleton, Stack, TextField, ToggleButton, ToggleButtonGroup, Tooltip, Typography, backdropClasses, circularProgressClasses, styled, } from '@mui/material';
34
- import { useDebounceFn, useLocalStorageState, useReactive } from 'ahooks';
35
- import { useUpdateEffect } from 'ahooks';
35
+ import { useDebounceFn, useLocalStorageState, useReactive, useUpdateEffect, useDeepCompareEffect } from 'ahooks';
36
36
  import cloneDeep from 'lodash/cloneDeep';
37
37
  import get from 'lodash/get';
38
38
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -375,7 +375,7 @@ function Layout({ loadState, loadedData }) {
375
375
  description: '',
376
376
  };
377
377
  };
378
- let mergedPropertiesValues = useMemo(() => {
378
+ let mergedPropertiesValues = useDeepCompareMemo(() => {
379
379
  return Object.fromEntries(Object.values(state.metadata.properties ?? {}).map(({ data }) => {
380
380
  return [
381
381
  data.id,
@@ -388,7 +388,7 @@ function Layout({ loadState, loadedData }) {
388
388
  },
389
389
  ];
390
390
  }));
391
- }, [JSON.stringify(state.metadata.properties), JSON.stringify(state.propertiesValue)]);
391
+ }, [state.metadata.properties, state.propertiesValue]);
392
392
  // 添加防抖函数,延迟渲染
393
393
  const { run: triggerRerender } = useDebounceFn(() => {
394
394
  // 发送消息到 iframe
@@ -421,9 +421,9 @@ function Layout({ loadState, loadedData }) {
421
421
  }
422
422
  }, { wait: 50 });
423
423
  // 当属性变化时触发重新渲染
424
- useEffect(() => {
424
+ useDeepCompareEffect(() => {
425
425
  triggerRerender();
426
- }, [JSON.stringify(mergedPropertiesValues), JSON.stringify(mergedAllBlocks), state.metadata.id, locale]);
426
+ }, [mergedPropertiesValues, mergedAllBlocks, state.metadata.id, locale]);
427
427
  const DraggingSplitPlaceholder = useMemo(() => {
428
428
  return (_jsx(Box, { sx: {
429
429
  p: 1.5,
@@ -628,7 +628,7 @@ function Layout({ loadState, loadedData }) {
628
628
  handleDeleteBlock,
629
629
  ]);
630
630
  // 修改 middlePanelContent - iframe 内部监听消息
631
- const middlePanelContent = useMemo(() => {
631
+ const middlePanelContent = useDeepCompareMemo(() => {
632
632
  // 如果在iframe内部,添加消息接收逻辑
633
633
  if (isInsideIframe) {
634
634
  if (loadState.type === '404' || loadState.type === 'loading') {
@@ -821,12 +821,12 @@ function Layout({ loadState, loadedData }) {
821
821
  locale,
822
822
  mode,
823
823
  theme,
824
- JSON.stringify(state.metadata || {}),
825
- JSON.stringify(mergedAllBlocks || []),
826
- JSON.stringify(mergedPropertiesValues || {}),
824
+ state.metadata || {},
825
+ mergedAllBlocks || [],
826
+ mergedPropertiesValues || {},
827
827
  handleDeleteBlock,
828
828
  ]);
829
- const rightPanelContent = useMemo(() => {
829
+ const rightPanelContent = useDeepCompareMemo(() => {
830
830
  if (state.draggingSplitPane) {
831
831
  return DraggingSplitPlaceholder;
832
832
  }
@@ -990,11 +990,11 @@ function Layout({ loadState, loadedData }) {
990
990
  };
991
991
  } }) }) }))] }));
992
992
  }, [
993
- JSON.stringify(state.metadata || {}),
993
+ state.metadata || {},
994
994
  locale,
995
995
  defaultLocale,
996
- JSON.stringify(mergedAllBlocks || []),
997
- JSON.stringify(mergedPropertiesValues || {}),
996
+ mergedAllBlocks || [],
997
+ mergedPropertiesValues || {},
998
998
  getStaticData,
999
999
  state.draggingSplitPane,
1000
1000
  mode,