Skip to content

Commit

Permalink
fix(client): fix the issue where adding block templates in the popup …
Browse files Browse the repository at this point in the history
…does not display (#4531)

* chore: avoid crashing

* fix(client): fix the issue where adding block templates in the popup does not display
  • Loading branch information
zhangzhonghe committed May 30, 2024
1 parent d83c102 commit 803ea80
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ interface RecursiveRemoveOptions {
}

const generateUid = (s: ISchema) => {
if (!s) {
return;
}
if (!s['x-uid']) {
s['x-uid'] = uid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function useRecordBlocks() {
if (fromOthersInPopup) {
return templateWrapCollection(templateSchema, { item, fromOthersInPopup });
}
templateWrap(templateSchema, { item });
return templateWrap(templateSchema, { item });
},
showAssociationFields: true,
};
Expand Down
5 changes: 3 additions & 2 deletions packages/core/client/src/schema-initializer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const gridRowColWrap = (schema: ISchema) => {
type: 'void',
'x-component': 'Grid.Col',
properties: {
[schema.name || uid()]: schema,
[schema?.name || uid()]: schema,
},
},
},
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 803ea80

Please sign in to comment.