fix: Field form values is not displayed

This commit is contained in:
chenos 2021-09-14 16:44:11 +08:00
parent a3c4a8dd9c
commit 819f1a3472

View File

@ -652,7 +652,7 @@ function CreateFieldButton() {
} }
function EditFieldButton() { function EditFieldButton() {
const { refresh } = useCollectionsContext(); const { refresh, findCollection } = useCollectionsContext();
const { service } = useTable(); const { service } = useTable();
const ctx = useContext(TableRowContext); const ctx = useContext(TableRowContext);
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
@ -688,7 +688,11 @@ function EditFieldButton() {
type={'link'} type={'link'}
onClick={() => { onClick={() => {
setVisible(true); setVisible(true);
form.setValues(clone(ctx.record)); const collection = findCollection(ctx.record.collection_name);
const values = collection?.generalFields?.find(
(field) => field.key === ctx.record.key,
);
form.setValues(clone(values || {}));
}} }}
> >