@blocklet/pages-kit-block-studio 0.7.10 → 0.7.12
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,7 +8,6 @@ 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';
|
|
12
11
|
import Toast, { ToastProvider } from '@arcblock/ux/lib/Toast';
|
|
13
12
|
import { createAxios } from '@blocklet/js-sdk';
|
|
14
13
|
import { PagesKitThemeProvider } from '@blocklet/pages-kit-inner-components/theme';
|
|
@@ -32,7 +31,7 @@ import PhoneAndroidIcon from '@mui/icons-material/PhoneAndroid';
|
|
|
32
31
|
import SettingsIcon from '@mui/icons-material/Settings';
|
|
33
32
|
import SortByAlphaIcon from '@mui/icons-material/SortByAlpha';
|
|
34
33
|
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';
|
|
35
|
-
import { useDebounceFn, useLocalStorageState, useReactive, useUpdateEffect
|
|
34
|
+
import { useDebounceFn, useLocalStorageState, useReactive, useUpdateEffect } from 'ahooks';
|
|
36
35
|
import cloneDeep from 'lodash/cloneDeep';
|
|
37
36
|
import get from 'lodash/get';
|
|
38
37
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -375,7 +374,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
375
374
|
description: '',
|
|
376
375
|
};
|
|
377
376
|
};
|
|
378
|
-
let mergedPropertiesValues =
|
|
377
|
+
let mergedPropertiesValues = useMemo(() => {
|
|
379
378
|
return Object.fromEntries(Object.values(state.metadata.properties ?? {}).map(({ data }) => {
|
|
380
379
|
return [
|
|
381
380
|
data.id,
|
|
@@ -388,7 +387,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
388
387
|
},
|
|
389
388
|
];
|
|
390
389
|
}));
|
|
391
|
-
}, [state.metadata.properties, state.propertiesValue]);
|
|
390
|
+
}, [JSON.stringify(state.metadata.properties), JSON.stringify(state.propertiesValue)]);
|
|
392
391
|
// 添加防抖函数,延迟渲染
|
|
393
392
|
const { run: triggerRerender } = useDebounceFn(() => {
|
|
394
393
|
// 发送消息到 iframe
|
|
@@ -421,9 +420,9 @@ function Layout({ loadState, loadedData }) {
|
|
|
421
420
|
}
|
|
422
421
|
}, { wait: 50 });
|
|
423
422
|
// 当属性变化时触发重新渲染
|
|
424
|
-
|
|
423
|
+
useEffect(() => {
|
|
425
424
|
triggerRerender();
|
|
426
|
-
}, [mergedPropertiesValues, mergedAllBlocks, state.metadata.id, locale]);
|
|
425
|
+
}, [JSON.stringify(mergedPropertiesValues), JSON.stringify(mergedAllBlocks), state.metadata.id, locale]);
|
|
427
426
|
const DraggingSplitPlaceholder = useMemo(() => {
|
|
428
427
|
return (_jsx(Box, { sx: {
|
|
429
428
|
p: 1.5,
|
|
@@ -628,7 +627,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
628
627
|
handleDeleteBlock,
|
|
629
628
|
]);
|
|
630
629
|
// 修改 middlePanelContent - iframe 内部监听消息
|
|
631
|
-
const middlePanelContent =
|
|
630
|
+
const middlePanelContent = useMemo(() => {
|
|
632
631
|
// 如果在iframe内部,添加消息接收逻辑
|
|
633
632
|
if (isInsideIframe) {
|
|
634
633
|
if (loadState.type === '404' || loadState.type === 'loading') {
|
|
@@ -821,12 +820,12 @@ function Layout({ loadState, loadedData }) {
|
|
|
821
820
|
locale,
|
|
822
821
|
mode,
|
|
823
822
|
theme,
|
|
824
|
-
state.metadata || {},
|
|
825
|
-
mergedAllBlocks || [],
|
|
826
|
-
mergedPropertiesValues || {},
|
|
823
|
+
JSON.stringify(state.metadata || {}),
|
|
824
|
+
JSON.stringify(mergedAllBlocks || []),
|
|
825
|
+
JSON.stringify(mergedPropertiesValues || {}),
|
|
827
826
|
handleDeleteBlock,
|
|
828
827
|
]);
|
|
829
|
-
const rightPanelContent =
|
|
828
|
+
const rightPanelContent = useMemo(() => {
|
|
830
829
|
if (state.draggingSplitPane) {
|
|
831
830
|
return DraggingSplitPlaceholder;
|
|
832
831
|
}
|
|
@@ -990,11 +989,11 @@ function Layout({ loadState, loadedData }) {
|
|
|
990
989
|
};
|
|
991
990
|
} }) }) }))] }));
|
|
992
991
|
}, [
|
|
993
|
-
state.metadata || {},
|
|
992
|
+
JSON.stringify(state.metadata || {}),
|
|
994
993
|
locale,
|
|
995
994
|
defaultLocale,
|
|
996
|
-
mergedAllBlocks || [],
|
|
997
|
-
mergedPropertiesValues || {},
|
|
995
|
+
JSON.stringify(mergedAllBlocks || []),
|
|
996
|
+
JSON.stringify(mergedPropertiesValues || {}),
|
|
998
997
|
getStaticData,
|
|
999
998
|
state.draggingSplitPane,
|
|
1000
999
|
mode,
|