fix: check if primary key exists
This commit is contained in:
parent
ddb6d69676
commit
b0aa0e2c41
@ -753,7 +753,7 @@ export const useRecordCollectionDataSourceItems = (
|
|||||||
|
|
||||||
export const useCollectionDataSourceItems = (componentName) => {
|
export const useCollectionDataSourceItems = (componentName) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { collections } = useCollectionManager();
|
const { collections, getCollectionFields } = useCollectionManager();
|
||||||
const { getTemplatesByCollection } = useSchemaTemplateManager();
|
const { getTemplatesByCollection } = useSchemaTemplateManager();
|
||||||
const [selected, setSelected] = useState([]);
|
const [selected, setSelected] = useState([]);
|
||||||
const [value, onChange] = useState(null);
|
const [value, onChange] = useState(null);
|
||||||
@ -775,7 +775,9 @@ export const useCollectionDataSourceItems = (componentName) => {
|
|||||||
const b = !value || selected.includes(item.name);
|
const b = !value || selected.includes(item.name);
|
||||||
if (item.inherit) {
|
if (item.inherit) {
|
||||||
return false;
|
return false;
|
||||||
} else if (item.autoGenId === false && !item.fields.find((v) => v.primaryKey)) {
|
}
|
||||||
|
const fields = getCollectionFields(item.name);
|
||||||
|
if (item.autoGenId === false && !fields.find((v) => v.primaryKey)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (['Kanban', 'FormItem'].includes(componentName) && item.template === 'view') {
|
} else if (['Kanban', 'FormItem'].includes(componentName) && item.template === 'view') {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user