Skip to content

Commit 3fee7b1

Browse files
committed
perf: limit operation list to 10 items on home page
1 parent 1743e82 commit 3fee7b1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/apis/operation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useSWRRefresh } from 'utils/swr'
1111
export type OrderBy = 'views' | 'hot' | 'id'
1212

1313
export interface UseOperationsParams {
14+
limit?: number
1415
orderBy?: OrderBy
1516
descending?: boolean
1617
keyword?: string
@@ -24,6 +25,7 @@ export interface UseOperationsParams {
2425
}
2526

2627
export function useOperations({
28+
limit = 50,
2729
orderBy,
2830
descending = true,
2931
keyword,
@@ -71,7 +73,7 @@ export function useOperations({
7173
return [
7274
'operations',
7375
{
74-
limit: 50,
76+
limit,
7577
page: pageIndex + 1,
7678
document: keyword,
7779
levelKeyword,

src/components/Operations.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const Operations: ComponentType = withSuspensable(() => {
2828
const [queryParams, setQueryParams] = useState<
2929
Omit<UseOperationsParams, 'operator'>
3030
>({
31+
limit: 10,
3132
orderBy: 'hot',
3233
})
3334
const [selectedOperators, setSelectedOperators] = useAtom(

0 commit comments

Comments
 (0)