Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Sep 20, 2024
1 parent de29899 commit 3561f4d
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
HTMLAttributes,
useContext,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState
Expand Down Expand Up @@ -69,19 +68,11 @@ interface MembershipViewProps extends HTMLAttributes<HTMLDivElement> {
members: MemberShips
}

export function MembershipView({
className,
members: propsMembers
}: MembershipViewProps) {
export function MembershipView({ className, members }: MembershipViewProps) {
const { isServerAdmin, isGroupAdmin } = useContext(UserGroupItemContext)
const [members, setMembers] = useState(propsMembers)
const [emptyItemVisible, setEmptyItemVisible] = useState(false)
const editable = isServerAdmin || isGroupAdmin

useEffect(() => {
setMembers(propsMembers)
}, [propsMembers])

const handleAddMember = () => {
if (!emptyItemVisible) {
setEmptyItemVisible(true)
Expand Down Expand Up @@ -155,7 +146,7 @@ function MembershipItem({ member, onRemoveEmptyItem }: MembershipItemProps) {
}
}, [member])

useLayoutEffect(() => {
useEffect(() => {
if (!member) {
trRef.current?.scrollIntoView({
behavior: 'smooth'
Expand Down

0 comments on commit 3561f4d

Please sign in to comment.