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.topActiveClass
: classObj.bottomActiveClass; : classObj.bottomActiveClass;
console.log('active?.id !== id', active?.id, id, active?.id !== id);
return ( return (
<tr <tr
ref={active?.id !== id ? setNodeRef : null} ref={active?.id !== id ? setNodeRef : null}

View File

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

View File

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

View File

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