fix: remove updateCollection
This commit is contained in:
parent
e087be887b
commit
fb997bc6b3
@ -74,7 +74,7 @@ const CurrentFields = (props) => {
|
||||
const { resource, targetKey } = props.collectionResource || {};
|
||||
const { [targetKey]: filterByTk, titleField } = useRecord();
|
||||
const [loadingRecord, setLoadingRecord] = React.useState<any>(null);
|
||||
const { updateCollection } = useCollectionManager();
|
||||
const { updateCollection, refreshCM } = useCollectionManager();
|
||||
|
||||
const columns: TableColumnProps<any>[] = [
|
||||
{
|
||||
@ -100,11 +100,12 @@ const CurrentFields = (props) => {
|
||||
resource
|
||||
.update({ filterByTk, values: { titleField: checked ? record.name : 'id' } })
|
||||
.then(async () => {
|
||||
const data = await props.refreshAsync();
|
||||
if (data?.data) {
|
||||
updateCollection(data.data);
|
||||
}
|
||||
await props.refreshAsync();
|
||||
// if (data?.data) {
|
||||
// // updateCollection(data.data);
|
||||
// }
|
||||
setLoadingRecord(null);
|
||||
refreshCM();
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoadingRecord(null);
|
||||
@ -180,7 +181,7 @@ const InheritFields = (props) => {
|
||||
const { [targetKey]: filterByTk, titleField, name } = useRecord();
|
||||
const [loadingRecord, setLoadingRecord] = React.useState(null);
|
||||
const { t } = useTranslation();
|
||||
const { updateCollection } = useCollectionManager();
|
||||
const { updateCollection, refreshCM } = useCollectionManager();
|
||||
|
||||
const columns: TableColumnProps<any>[] = [
|
||||
{
|
||||
@ -206,11 +207,12 @@ const InheritFields = (props) => {
|
||||
resource
|
||||
.update({ filterByTk, values: { titleField: checked ? record.name : 'id' } })
|
||||
.then(async () => {
|
||||
const data = await props.refreshAsync();
|
||||
if (data?.data) {
|
||||
updateCollection(data.data);
|
||||
}
|
||||
await props.refreshAsync();
|
||||
// if (data?.data) {
|
||||
// updateCollection(data.data);
|
||||
// }
|
||||
setLoadingRecord(null);
|
||||
refreshCM();
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoadingRecord(null);
|
||||
|
@ -20905,6 +20905,13 @@ react-drag-listview@^0.1.9:
|
||||
babel-runtime "^6.26.0"
|
||||
prop-types "^15.5.8"
|
||||
|
||||
react-error-boundary@^3.1.4:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.4.tgz#255db92b23197108757a888b01e5b729919abde0"
|
||||
integrity sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.12.5"
|
||||
|
||||
react-error-boundary@^4.0.3:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.npmmirror.com/react-error-boundary/-/react-error-boundary-4.0.3.tgz#f811497c06d53ea1206817ee82c6e5c6a27becd9"
|
||||
|
Loading…
Reference in New Issue
Block a user