fix: refresh collection name when update (#3797)
This commit is contained in:
		
							parent
							
								
									570e5c1354
								
							
						
					
					
						commit
						00cf5fa02c
					
				@ -9,13 +9,14 @@ import {
 | 
				
			|||||||
  tval,
 | 
					  tval,
 | 
				
			||||||
  useAPIClient,
 | 
					  useAPIClient,
 | 
				
			||||||
  useActionContext,
 | 
					  useActionContext,
 | 
				
			||||||
  useCancelAction,
 | 
					 | 
				
			||||||
  useCollectionManager_deprecated,
 | 
					  useCollectionManager_deprecated,
 | 
				
			||||||
  useCompile,
 | 
					  useCompile,
 | 
				
			||||||
  useRecord,
 | 
					  useRecord,
 | 
				
			||||||
  useRequest,
 | 
					  useRequest,
 | 
				
			||||||
  useResourceActionContext,
 | 
					  useResourceActionContext,
 | 
				
			||||||
  useResourceContext,
 | 
					  useResourceContext,
 | 
				
			||||||
 | 
					  useCancelAction,
 | 
				
			||||||
 | 
					  useDataSourceManager,
 | 
				
			||||||
} from '@nocobase/client';
 | 
					} from '@nocobase/client';
 | 
				
			||||||
import cloneDeep from 'lodash/cloneDeep';
 | 
					import cloneDeep from 'lodash/cloneDeep';
 | 
				
			||||||
import omit from 'lodash/omit';
 | 
					import omit from 'lodash/omit';
 | 
				
			||||||
@ -130,6 +131,7 @@ export const useUpdateCollectionActionAndRefreshCM = (options) => {
 | 
				
			|||||||
  const { resource, targetKey } = useResourceContext();
 | 
					  const { resource, targetKey } = useResourceContext();
 | 
				
			||||||
  const { [targetKey]: filterByTk } = useRecord();
 | 
					  const { [targetKey]: filterByTk } = useRecord();
 | 
				
			||||||
  const api = useAPIClient();
 | 
					  const api = useAPIClient();
 | 
				
			||||||
 | 
					  const dm = useDataSourceManager();
 | 
				
			||||||
  return {
 | 
					  return {
 | 
				
			||||||
    async run() {
 | 
					    async run() {
 | 
				
			||||||
      await form.submit();
 | 
					      await form.submit();
 | 
				
			||||||
@ -140,6 +142,7 @@ export const useUpdateCollectionActionAndRefreshCM = (options) => {
 | 
				
			|||||||
          ...omit(form.values, ['fields', 'autoGenId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy', 'sortable']),
 | 
					          ...omit(form.values, ['fields', 'autoGenId', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy', 'sortable']),
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					      await dm.getDataSource(name).reload();
 | 
				
			||||||
      ctx.setVisible(false);
 | 
					      ctx.setVisible(false);
 | 
				
			||||||
      await form.reset();
 | 
					      await form.reset();
 | 
				
			||||||
      refresh();
 | 
					      refresh();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user