### 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)
This commit is contained in:
parent
d197f33646
commit
978b580dcf
1 changed files with 6 additions and 1 deletions
|
|
@ -38,7 +38,12 @@ const KnowledgeList = () => {
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
loading,
|
loading,
|
||||||
} = useInfiniteFetchKnowledgeList();
|
} = 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(() => {
|
const total = useMemo(() => {
|
||||||
return data?.pages.at(-1).total ?? 0;
|
return data?.pages.at(-1).total ?? 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue