Skip to content

Commit a8b7287

Browse files
baymax2099gary-Shen
authored andcommitted
fix(frontend): paginate by data inner id
1 parent ff3f6ef commit a8b7287

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
@@ -148,9 +148,15 @@ const AnnotationPage = () => {
148148
[t],
149149
);
150150

151+
// 默认加载数量常量
152+
const PAGE_SIZE = 40;
151153
// 滚动加载
152154
const [totalCount, setTotalCount] = useState<number>(0);
153155
const currentPage = useRef<number>(1);
156+
if (currentPage.current === 1) {
157+
currentPage.current = sample?.data.inner_id ? Math.floor(sample.data.inner_id / PAGE_SIZE) + 1 : 1;
158+
}
159+
154160
const fetchSamples = useCallback(async () => {
155161
if (!routeParams.taskId) {
156162
return Promise.resolve([]);
@@ -159,7 +165,7 @@ const AnnotationPage = () => {
159165
const { data, meta_data } = await getSamples({
160166
task_id: +routeParams.taskId!,
161167
page: currentPage.current,
162-
size: 40,
168+
size: PAGE_SIZE,
163169
});
164170

165171
currentPage.current += 1;

0 commit comments

Comments
 (0)