diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/PermisionProvider.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/PermisionProvider.tsx index 4c4322c31e..dd09b18023 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/PermisionProvider.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/PermisionProvider.tsx @@ -1,5 +1,5 @@ import { message } from 'antd'; -import React, { createContext, useContext, useState } from 'react'; +import React, { createContext, useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useAPIClient, useRecord, RecordContext_deprecated, SchemaComponentOptions } from '@nocobase/client'; import { CurrentRolesContext } from './'; @@ -25,7 +25,9 @@ export const PermissionProvider = (props) => { role[key] = true; }); const [currentRecord, setCurrentRecord] = useState(role); - + useEffect(() => { + setCurrentRecord(role); + }, [role]); return ( { url: `dataSources/${record.key}/roles:update`, data: form.values, method: 'post', - params: { filterByTk: role.name }, + params: { filterByTk: form.values.roleName }, }); setCurrentRecord({ ...currentRecord, ...form.values }); message.success(t('Saved successfully'));