commit提交记录分页问题‘

This commit is contained in:
caishi 2024-11-14 16:21:26 +08:00
parent b863d8bfe6
commit 6b9f413532
1 changed files with 4 additions and 5 deletions

View File

@ -58,7 +58,6 @@ export default (props) => {
const { sha , projectsId, owner } = match.params;
const [ dropLoading, setDropLoading] = useState(false); //loading
const [hasMore, setHasMore] = useState(true); //
const limit = 200;
const fRef = useRef();
@ -107,8 +106,9 @@ export default (props) => {
async function InitDiffData (){
let f = fRef.current ? fRef.current.files : [];
let p = (fRef.current && fRef.current.page) || 1;
if (!hasMore || dropLoading || !isSpin) {
let p = fRef.current ? fRef.current.page : 1;
let hm = fRef.current ? fRef.current.hasMore : true;
if (!hm || dropLoading || !isSpin) {
return;
}
setDropLoading(true);
@ -119,8 +119,7 @@ export default (props) => {
if(res?.status === 200){
let arr = p === 1 ? res.data.files : [...f,...res.data.files];
setData(res.data);
fRef.current = {files:arr,page:p+1};
setHasMore(arr.length === limit);
fRef.current = {files:arr,page:p+1,hasMore:arr.length === limit};
setDropLoading(false);
}
})