From 88a3a7c339b4b4e2cf190984100491c151ea87eb Mon Sep 17 00:00:00 2001 From: bigfengyu Date: Thu, 26 Sep 2019 14:33:30 +0800 Subject: [PATCH] fix: sort fail --- src/components/editor/InterfaceList.tsx | 9 +++++---- src/components/editor/RepositoryEditor.tsx | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/editor/InterfaceList.tsx b/src/components/editor/InterfaceList.tsx index abd7075..051976b 100644 --- a/src/components/editor/InterfaceList.tsx +++ b/src/components/editor/InterfaceList.tsx @@ -117,7 +117,6 @@ const mapStateToProps = (state: RootState) => ({ }) const mapDispatchToProps = { replace, - onSortInterfaceList: sortInterfaceList, deleteInterface, } const InterfaceWrap = connect( @@ -132,15 +131,17 @@ interface InterfaceListProps { mod: Module repository: Repository } -function InterfaceList(props: InterfaceListProps, context: any) { +function InterfaceList(props: InterfaceListProps) { const [open, setOpen] = useState(false) + const dispatch = useDispatch() const auth = useSelector((state: RootState) => state.auth) const { repository, itf, itfs = [], mod } = props const isOwned = repository.owner!.id === auth.id const isJoined = repository.members!.find((item: any) => item.id === auth.id) const handleSort = (_: any, sortable: any) => { - const { onSortInterfaceList } = context - onSortInterfaceList(sortable.toArray()) + dispatch(sortInterfaceList(sortable.toArray(), mod.id, () => { + /** empty */ + })) } return (
diff --git a/src/components/editor/RepositoryEditor.tsx b/src/components/editor/RepositoryEditor.tsx index 9cdef8d..49b6576 100644 --- a/src/components/editor/RepositoryEditor.tsx +++ b/src/components/editor/RepositoryEditor.tsx @@ -26,7 +26,6 @@ import { deleteInterface, lockInterface, unlockInterface, - sortInterfaceList } from '../../actions/interface' import { addProperty, @@ -74,7 +73,6 @@ class RepositoryEditor extends Component { onDeleteInterface: PropTypes.func.isRequired, onLockInterface: PropTypes.func.isRequired, onUnlockInterface: PropTypes.func.isRequired, - onSortInterfaceList: PropTypes.func.isRequired, onAddProperty: PropTypes.func.isRequired, onUpdateProperty: PropTypes.func.isRequired, onUpdateProperties: PropTypes.func.isRequired, @@ -278,7 +276,6 @@ const mapDispatchToProps = { onDeleteInterface: deleteInterface, onLockInterface: lockInterface, onUnlockInterface: unlockInterface, - onSortInterfaceList: sortInterfaceList, onAddProperty: addProperty, onUpdateProperty: updateProperty, onUpdateProperties: updateProperties,