fix: detail block has no data (#3003)

* chore: add comments

* fix: detail block has no data
This commit is contained in:
被雨水过滤的空气-Rain 2023-11-09 12:55:06 +08:00 committed by GitHub
parent e74fcc32e7
commit e73ad1b98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View File

@ -93,9 +93,6 @@ const useResource = (props: UseResourceProps) => {
if (sourceId) { if (sourceId) {
return api.resource(resource, sourceId); return api.resource(resource, sourceId);
} }
if (record[association?.sourceKey || 'id']) {
return api.resource(resource, record[association?.sourceKey || 'id']);
}
if (record?.__parent?.[association?.sourceKey || 'id']) { if (record?.__parent?.[association?.sourceKey || 'id']) {
return api.resource(resource, record.__parent[association?.sourceKey || 'id']); return api.resource(resource, record.__parent[association?.sourceKey || 'id']);
} }

View File

@ -167,6 +167,7 @@ export const EditRequired = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { dn, refresh } = useDesignable(); const { dn, refresh } = useDesignable();
// TODO: FormField 好像被弃用了,应该删除掉
return !field.readPretty && fieldSchema['x-component'] !== 'FormField' ? ( return !field.readPretty && fieldSchema['x-component'] !== 'FormField' ? (
<SchemaSettings.SwitchItem <SchemaSettings.SwitchItem
key="required" key="required"

View File

@ -138,6 +138,7 @@ export const GeneralSchemaItems: React.FC<{
}} }}
/> />
)} )}
{/* TODO: FormField 好像被弃用了,应该删除掉 */}
{!field.readPretty && fieldSchema['x-component'] !== 'FormField' && required && ( {!field.readPretty && fieldSchema['x-component'] !== 'FormField' && required && (
<SchemaSettings.SwitchItem <SchemaSettings.SwitchItem
key="required" key="required"