Commit 8e4a13e7 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复加载更多出现重复数据的问题

parent 2541d425
......@@ -199,16 +199,17 @@ export default class RecordList extends React.Component<RecordListProps, RecordL
return;
}
this.setState((prevState: any) => ({
size: prevState.size + 1,
}));
this.getRecordList().then(res => {
const { receivedList, page, size } = this.state;
this.setState({
receivedList: {
...receivedList,
data: receivedList.data.concat(res.data),
},
hasMore: checkMore(page, size as number, res.data.length, res.totalCount),
page: prevState.page + 1,
}), () => {
this.getRecordList().then(res => {
const { receivedList, page, size } = this.state;
this.setState({
receivedList: {
...receivedList,
data: receivedList.data.concat(res.data),
},
hasMore: checkMore(page, size as number, res.data.length, res.totalCount),
});
});
});
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment