diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 5dcc14628..9d30a56f8 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -307,10 +307,7 @@ export const BlockProvider = (props: { const resource = useResource(props); const { appends, updateAssociationValues } = useAssociationNames(); const params = useMemo(() => { - if (!props.params) { - return props.params; - } - if (!props.params['appends']) { + if (!props.params?.['appends']) { return { ...props.params, appends }; } return { ...props.params }; diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx index a3cfbb9ea..35c168cff 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx @@ -5,6 +5,9 @@ import { useTranslation } from 'react-i18next'; import { EllipsisWithTooltip, useCompile } from '../../../'; import { useAPIClient } from '../../../api-client'; import { useCollectionManager } from '../../hooks/useCollectionManager'; +function isObject(value) { + return Object.prototype.toString.call(value) === '[object Object]'; +} const mapFields = ['lineString', 'point', 'circle', 'polygon']; export const PreviewTable = (props) => { @@ -70,7 +73,7 @@ export const PreviewTable = (props) => { 'x-component': schema && fieldSource ? 'CollectionField' : 'Input', 'x-read-pretty': true, 'x-collection-field': fieldSource?.join('.'), - default: JSON.stringify(content), + default: isObject(content) ? JSON.stringify(content) : content, }, }, }; diff --git a/packages/plugins/@nocobase/plugin-map/src/client/components/ReadPretty.tsx b/packages/plugins/@nocobase/plugin-map/src/client/components/ReadPretty.tsx index 4b36ea091..ee1aa9ef4 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/components/ReadPretty.tsx +++ b/packages/plugins/@nocobase/plugin-map/src/client/components/ReadPretty.tsx @@ -16,7 +16,7 @@ const ReadPretty = (props) => { return (
- {value?.map((item) => (Array.isArray(item) ? `(${item.join(',')})` : item)).join(',')} + {value?.map?.((item) => (Array.isArray(item) ? `(${item.join(',')})` : item)).join(',')}
);