StatusList: fix infinite scrolling
(apparently I don't understand how useCallback works)
This commit is contained in:
parent
666c2dd0ce
commit
0a34bcfcba
|
@ -68,11 +68,11 @@ const StatusList: React.FC<IStatusList> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLoadOlder = useCallback(debounce(() => {
|
const handleLoadOlder = useCallback(debounce(() => {
|
||||||
const loadMoreID = lastStatusId || statusIds.last();
|
const maxId = lastStatusId || statusIds.last();
|
||||||
if (onLoadMore && loadMoreID) {
|
if (onLoadMore && maxId) {
|
||||||
onLoadMore(loadMoreID);
|
onLoadMore(maxId);
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), []);
|
}, 300, { leading: true }), [onLoadMore, lastStatusId, statusIds.last()]);
|
||||||
|
|
||||||
const selectChild = (index: number) => {
|
const selectChild = (index: number) => {
|
||||||
node.current?.scrollIntoView({
|
node.current?.scrollIntoView({
|
||||||
|
|
Loading…
Reference in New Issue