fix(client): fix the issue where adding block templates in the popup does not display (#4531)

* chore: avoid crashing

* fix(client): fix the issue where adding block templates in the popup does not display
This commit is contained in:
Zeke Zhang 2024-05-30 17:45:35 +08:00 committed by GitHub
parent d83c102492
commit 803ea80e4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View File

@ -230,7 +230,6 @@ const SortableRow = (props) => {
? classObj.topActiveClass
: classObj.bottomActiveClass;
console.log('active?.id !== id', active?.id, id, active?.id !== id);
return (
<tr
ref={active?.id !== id ? setNodeRef : null}

View File

@ -65,6 +65,9 @@ interface RecursiveRemoveOptions {
}
const generateUid = (s: ISchema) => {
if (!s) {
return;
}
if (!s['x-uid']) {
s['x-uid'] = uid();
}

View File

@ -178,7 +178,7 @@ function useRecordBlocks() {
if (fromOthersInPopup) {
return templateWrapCollection(templateSchema, { item, fromOthersInPopup });
}
templateWrap(templateSchema, { item });
return templateWrap(templateSchema, { item });
},
showAssociationFields: true,
};

View File

@ -42,7 +42,7 @@ export const gridRowColWrap = (schema: ISchema) => {
type: 'void',
'x-component': 'Grid.Col',
properties: {
[schema.name || uid()]: schema,
[schema?.name || uid()]: schema,
},
},
},
@ -968,13 +968,14 @@ export const useCollectionDataSourceItems = ({
// 目的是使点击无效
onClick() {},
componentProps: {
...dataBlockInitializerProps,
icon: null,
title: otherText || t('Other records'),
name: 'otherRecords',
showAssociationFields: false,
onlyCurrentDataSource: false,
hideChildrenIfSingleCollection: false,
onCreateBlockSchema: dataBlockInitializerProps.onCreateBlockSchema,
fromOthersInPopup: true,
componentType: componentTypeMap[componentName] || componentName,
filter({ collection, associationField }) {
if (filterOtherRecordsCollection) {