Просмотр исходного кода

扩大滚动预加载窗口,减少加载等待感

PAGE_SIZE 20→40,rootMargin 800px→2000px

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
刘立冬 16 часов назад
Родитель
Сommit
50a9778c7a

+ 2 - 2
src/views/publishContent/weCom/components/videoSelectModal/index.tsx

@@ -38,7 +38,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 	const { videoCategoryOptions } = useVideoCategoryOptions();
 	const [category, setCategory] = useState<string>();
 	const sort = VideoSortType.推荐指数;
-	const PAGE_SIZE = 20;
+	const PAGE_SIZE = 40;
 	const [searchTerm, setSearchTerm] = useState<string>('');
 	const [currentPage, setCurrentPage] = useState(1);
 	const [total, setTotal] = useState(0);
@@ -121,7 +121,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 			if (entries[0].isIntersecting && hasMoreRef.current && !loadingMoreRef.current && !loadingRef.current) {
 				getVideoListRef.current?.(currentPageRef.current + 1, true);
 			}
-		}, { rootMargin: '800px' });
+		}, { rootMargin: '2000px' });
 		observerRef.current.observe(node);
 	}, []);
 

+ 2 - 2
src/views/publishContent/weGZH/components/videoSelectModal/index.tsx

@@ -34,7 +34,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
 	const { videoCategoryOptions } = useVideoCategoryOptions();
 	const [category, setCategory] = useState<string>();
 	const sort = VideoSortType.推荐指数;
-	const PAGE_SIZE = 20;
+	const PAGE_SIZE = 40;
 	const [searchTerm, setSearchTerm] = useState<string>('');
 	const [currentPage, setCurrentPage] = useState(1);
 	const [total, setTotal] = useState(0);
@@ -132,7 +132,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
 			if (entries[0].isIntersecting && hasMoreRef.current && !loadingMoreRef.current && !loadingRef.current) {
 				getVideoListRef.current?.(currentPageRef.current + 1, true);
 			}
-		}, { rootMargin: '800px' });
+		}, { rootMargin: '2000px' });
 		observerRef.current.observe(node);
 	}, []);