Skip to content

Commit

Permalink
Fix: Knowledge base page crashes when network connection is lost. #4894
Browse files Browse the repository at this point in the history
… (#4895)

### What problem does this PR solve?

Fix: Knowledge base page crashes when network connection is lost. #4894
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
cike8899 authored Feb 12, 2025
1 parent d197f33 commit 978b580
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/src/pages/knowledge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ const KnowledgeList = () => {
handleInputChange,
loading,
} = useInfiniteFetchKnowledgeList();
const nextList = data?.pages?.flatMap((x) => x.kbs) ?? [];

const nextList = useMemo(() => {
const list =
data?.pages?.flatMap((x) => (Array.isArray(x.kbs) ? x.kbs : [])) ?? [];
return list;
}, [data?.pages]);

const total = useMemo(() => {
return data?.pages.at(-1).total ?? 0;
Expand Down

0 comments on commit 978b580

Please sign in to comment.