Skip to content

Commit eb0e5c1

Browse files
authored
fix(frontend): paginate by data inner id
1 parent e6c99f4 commit eb0e5c1

File tree

1 file changed

+7
-1
lines changed
  • apps/frontend/src/pages/tasks.[id].samples.[id]

1 file changed

+7
-1
lines changed

apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,15 @@ const AnnotationPage = () => {
145145
[t],
146146
);
147147

148+
// 默认加载数量常量
149+
const PAGE_SIZE = 40;
148150
// 滚动加载
149151
const [totalCount, setTotalCount] = useState<number>(0);
150152
const currentPage = useRef<number>(1);
153+
if (currentPage.current === 1) {
154+
currentPage.current = sample?.data.inner_id ? Math.floor(sample.data.inner_id / PAGE_SIZE) + 1 : 1;
155+
}
156+
151157
const fetchSamples = useCallback(async () => {
152158
if (!routeParams.taskId) {
153159
return Promise.resolve([]);
@@ -156,7 +162,7 @@ const AnnotationPage = () => {
156162
const { data, meta_data } = await getSamples({
157163
task_id: +routeParams.taskId!,
158164
page: currentPage.current,
159-
size: 40,
165+
size: PAGE_SIZE,
160166
});
161167

162168
currentPage.current += 1;

0 commit comments

Comments
 (0)