fix: association data params missing appends (#3103)
* fix: association data params missing appends * refactor: code improve
This commit is contained in:
parent
f5dc8cebf8
commit
0cf045d142
@ -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 };
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ const ReadPretty = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<EllipsisWithTooltip ellipsis={true}>
|
||||
{value?.map((item) => (Array.isArray(item) ? `(${item.join(',')})` : item)).join(',')}
|
||||
{value?.map?.((item) => (Array.isArray(item) ? `(${item.join(',')})` : item)).join(',')}
|
||||
</EllipsisWithTooltip>
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user