Skip to content

Commit

Permalink
fix(frontend): add inner id and updated_at sorter
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Apr 19, 2024
1 parent fff8f41 commit 516bfc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions apps/frontend/src/loaders/task.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export async function taskLoader({ params, request }: LoaderFunctionArgs) {
if (searchParams.get('isNew') !== 'true') {
const preAnnotationQueryKey = preAnnotationKey.list({ task_id: +params.taskId });

// @ts-ignore
delete queryParams.sort;

result.preAnnotations = await queryClient.fetchQuery({
queryKey: preAnnotationQueryKey,
queryFn: () => getPreAnnotations(queryParams),
Expand Down
9 changes: 3 additions & 6 deletions apps/frontend/src/pages/tasks.[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const Samples = () => {
dataIndex: 'inner_id',
key: 'inner_id',
align: 'left',
sorter: true,
},
{
title: '文件名',
Expand Down Expand Up @@ -222,6 +223,7 @@ const Samples = () => {
dataIndex: 'updated_at',
key: 'updated_at',
align: 'left',
sorter: true,
render: (updated_at, record) => {
if (record.file?.filename?.endsWith('.jsonl')) {
return '-';
Expand Down Expand Up @@ -349,12 +351,7 @@ const Samples = () => {
}, [task?.media_type]);

const data = useMemo(() => {
return [
...(preAnnotations ?? []),
...(samples ?? []).sort(
(a, b) => new Date(b.created_at ?? '').valueOf() - new Date(a.created_at ?? '').valueOf(),
),
];
return [...(preAnnotations ?? []), ...(samples ?? [])];
}, [preAnnotations, samples]);

return (
Expand Down

0 comments on commit 516bfc2

Please sign in to comment.