perf scroll components (#2676)

* perf: add scroll list && virtualist (#2665)

* perf: chatHistorySlider add virtualList

* perf: dataCard add scroll

* fix: ts

* perf: scroll list components

* perf: hook refresh

---------

Co-authored-by: papapatrick <109422393+Patrickill@users.noreply.github.com>
This commit is contained in:
Archer
2024-09-11 19:53:49 +08:00
committed by GitHub
parent 5101c7a6dc
commit 6331f4b845
17 changed files with 413 additions and 335 deletions

View File

@@ -198,7 +198,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
});
const {
list,
scrollDataList,
setData,
ScrollList,
isLoading: isRequesting,
@@ -206,7 +206,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
scroll2Top
} = useScrollPagination(getChatInputGuideList, {
refreshDeps: [searchKey],
debounceWait: 300,
// debounceWait: 300,
itemHeight: 48,
overscan: 20,
@@ -389,7 +389,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
</Flex>
{/* new data input */}
{newData !== undefined && (
<Box mt={5} ml={list.length > 0 ? 7 : 0}>
<Box mt={5} ml={scrollDataList.length > 0 ? 7 : 0}>
<MyInput
autoFocus
rightIcon={<MyIcon name={'save'} w={'14px'} cursor={'pointer'} />}
@@ -412,7 +412,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
fontSize={'sm'}
EmptyChildren={<EmptyTip text={chatT('chat_input_guide_lexicon_is_empty')} />}
>
{list.map((data, index) => {
{scrollDataList.map((data, index) => {
const item = data.data;
const selected = selectedRows.includes(item._id);