diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js index 13130394a..d81c6db46 100644 --- a/public/react/src/modules/courses/members/ChangeRolePop.js +++ b/public/react/src/modules/courses/members/ChangeRolePop.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, memo } from 'react' import { trigger, WordsBtn } from 'educoder' import { Input, Checkbox, Popconfirm } from "antd"; import axios from 'axios' @@ -8,9 +8,11 @@ import axios from 'axios' */ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) { const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles) - useEffect(() => { - setCheckBoxRoles(member_roles) - }, [member_roles]) + // useEffect(() => { + // if (checkBoxRoles.length != member_roles.length) { // 死循环 + // setCheckBoxRoles(member_roles) + // } + // }, [member_roles]) function onCheckBoxChange(val) { console.log(val) @@ -77,4 +79,4 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces ) } -export default ChangeRolePop \ No newline at end of file +export default memo(ChangeRolePop) \ No newline at end of file diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index ab29dde45..33d434329 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -149,7 +149,7 @@ const buildColumns = (that,isParent) => { return ( that.onDelete(record)} style={'grey'}>删除学生 - { showNotification={that.props.showNotification} getUserId={that.props.isUserid} fetchUser={that.props.fetchUser} - > + >} ) },