diff --git a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx index f847095e6..03cd26bc9 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx @@ -206,6 +206,9 @@ export const AddFieldAction = (props) => { if (v.value === 'id') { return typeof record['autoGenId'] === 'boolean' ? record['autoGenId'] : true; } else if (v.value === 'tableoid') { + if (include?.length) { + return include.includes(v.value); + } return database?.dialect === 'postgres'; } else { return typeof record[v.value] === 'boolean' ? record[v.value] : true; 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 35c168cff..fc81a4c89 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx @@ -5,9 +5,6 @@ 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) => { @@ -73,7 +70,7 @@ export const PreviewTable = (props) => { 'x-component': schema && fieldSource ? 'CollectionField' : 'Input', 'x-read-pretty': true, 'x-collection-field': fieldSource?.join('.'), - default: isObject(content) ? JSON.stringify(content) : content, + default: item.interface === 'json' ? JSON.stringify(content) : content, }, }, };