fix(client): avoid cannot getField by randomly generated name and throw error (#294)
Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
parent
fcfde7ed0a
commit
8e11e8d364
@ -18,7 +18,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
const { getField } = useCollection();
|
const { getField } = useCollection();
|
||||||
const collectionField = getField(fieldSchema.name);
|
const collectionField = getField(fieldSchema.name);
|
||||||
const [record, setRecord] = useState({});
|
const [record, setRecord] = useState({});
|
||||||
return (
|
return collectionField ? (
|
||||||
<div>
|
<div>
|
||||||
<BlockAssociationContext.Provider value={`${collectionField.collectionName}.${collectionField.name}`}>
|
<BlockAssociationContext.Provider value={`${collectionField.collectionName}.${collectionField.name}`}>
|
||||||
<CollectionProvider name={collectionField.target}>
|
<CollectionProvider name={collectionField.target}>
|
||||||
@ -48,5 +48,5 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|||||||
</CollectionProvider>
|
</CollectionProvider>
|
||||||
</BlockAssociationContext.Provider>
|
</BlockAssociationContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
);
|
) : null;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user