-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InfiniteScroll loadMore 初始化调用两次接口 #5983
Comments
有可能是第一次调用 具体的可以来个复现 demo, codesandbox or stackblitz. |
Hi, zxh0125. Please provide a online reproduction so that we can help you troubleshoot the problem. You can create a demo by codesandbox or stackblitz. 我们需要你提供一个在线的重现实例,以便于我们帮你排查问题。你可以通过 codesandbox 或 stackblitz 创建一个实例。 |
我也有同样的问题,不是调用两次啊,如果高度不够一致调,可怎么处理 |
你后来怎么解决的呢 |
把你们官网的demo1, setData([1]).就复现了,因为一直触发源码中的useEffect |
Version of antd-mobile
5.28.0
Operating system and its version
Others
Browser and its version
微信
Sandbox to reproduce
No response
What happened?
/*
*/
import { InfiniteScroll, List } from 'antd-mobile'
import { memo, useState } from 'react'
import { sleep } from 'antd-mobile/es/utils/sleep'
import { history } from 'umi'
import styles from './index.less'
import ListItem from './ListItem'
import { getOrders } from '@/services/order'
import type { ISaveOrderRes } from '@/types/sale/sumbitOrder'
let count = 0
export async function mockRequest() {
if (count >= 5) {
return []
}
await sleep(2000)
count++
return [
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
]
}
export default memo(function Me() {
const offset = 0
const limit = 4
const [hasMore, setHasMore] = useState(true)
// const [offset, setOffset] = useState(0)
// const [limit, setLimit] = useState(10)
const [orderData, setOrderData] = useState<ISaveOrderRes[]>([])
// const getOrders=()=>{
// }
const loadMore = async () => {
count++
}
const goDetail = (id: string) => {
history.push(
/purchasedetail/${id}
)}
return (
)
})
Relevant log output
No response
The text was updated successfully, but these errors were encountered: