fix: source collections not updated during synchronization in view collection (#2480)
This commit is contained in:
parent
1977e00414
commit
2ea97541c6
@ -30,6 +30,7 @@ const PreviewCom = (props) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [dataSource, setDataSource] = useState([]);
|
||||
const [sourceFields, setSourceFields] = useState([]);
|
||||
const [sourceCollections, setSourceCollections] = useState(sources);
|
||||
const field: any = useField();
|
||||
const form = useForm();
|
||||
const { getCollection, getInterface, getCollectionFields, getInheritCollections, getParentCollectionFields } =
|
||||
@ -38,7 +39,7 @@ const PreviewCom = (props) => {
|
||||
const initOptions = getOptions().filter((v) => !['relation', 'systemInfo'].includes(v.key));
|
||||
useEffect(() => {
|
||||
const data = [];
|
||||
sources.forEach((item) => {
|
||||
sourceCollections.forEach((item) => {
|
||||
const collection = getCollection(item);
|
||||
const inherits = getInheritCollections(item);
|
||||
const result = inherits.map((v) => {
|
||||
@ -70,8 +71,7 @@ const PreviewCom = (props) => {
|
||||
});
|
||||
});
|
||||
setSourceFields(data);
|
||||
}, [sources, databaseView]);
|
||||
|
||||
}, [sourceCollections, databaseView]);
|
||||
useEffect(() => {
|
||||
if (databaseView) {
|
||||
setLoading(true);
|
||||
@ -92,6 +92,7 @@ const PreviewCom = (props) => {
|
||||
field.value = fieldsData;
|
||||
setDataSource(fieldsData);
|
||||
form.setValuesIn('sources', data.data?.sources);
|
||||
setSourceCollections(data.data?.sources);
|
||||
}
|
||||
}).catch;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user