Skip to content

Commit 68ea354

Browse files
committed
perf: add virtual list of inbox list
1 parent f09f701 commit 68ea354

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

client/web/src/routes/Main/Content/Inbox/Sidebar.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { PillTabPane, PillTabs } from '@/components/PillTabs';
2121
import { SectionHeader } from '@/components/SectionHeader';
2222
import { openReconfirmModalP } from '@/components/Modal';
2323
import { CommonSidebarWrapper } from '@/components/CommonSidebarWrapper';
24+
import { Virtuoso } from 'react-virtuoso';
2425

2526
const buildLink = (itemId: string) => `/main/inbox/${itemId}`;
2627

@@ -135,18 +136,31 @@ export const InboxSidebar: React.FC = React.memo(() => {
135136
{t('收件箱')}
136137
</SectionHeader>
137138

138-
<div className="overflow-hidden">
139+
<div className="overflow-hidden flex-1">
139140
<PillTabs
141+
className="h-full"
140142
items={[
141143
{
142144
key: '1',
143145
label: `${t('全部')}`,
144-
children: <>{fullList.map((item) => renderInbox(item))}</>,
146+
children: (
147+
<Virtuoso
148+
className="h-full"
149+
data={fullList}
150+
itemContent={(index, item) => renderInbox(item)}
151+
/>
152+
),
145153
},
146154
{
147155
key: '2',
148156
label: `${t('未读')} (${unreadList.length})`,
149-
children: <>{unreadList.map((item) => renderInbox(item))}</>,
157+
children: (
158+
<Virtuoso
159+
className="h-full"
160+
data={unreadList}
161+
itemContent={(index, item) => renderInbox(item)}
162+
/>
163+
),
150164
},
151165
]}
152166
/>

0 commit comments

Comments
 (0)