diff --git a/web/src/hooks/chunk-hooks.ts b/web/src/hooks/chunk-hooks.ts index 374f1c98335..052f2d17c62 100644 --- a/web/src/hooks/chunk-hooks.ts +++ b/web/src/hooks/chunk-hooks.ts @@ -45,9 +45,8 @@ export const useFetchNextChunkList = (): ResponseGetType<{ debouncedSearchString, available, ], - - initialData: { data: [], total: 0, documentInfo: {} }, - // placeholderData: keepPreviousData, + placeholderData: (previousData) => + previousData ?? { data: [], total: 0, documentInfo: {} }, // https://github.com/TanStack/query/issues/8183 gcTime: 0, queryFn: async () => { const { data } = await kbService.chunk_list({ diff --git a/web/src/pages/add-knowledge/components/knowledge-chunk/components/document-preview/preview.tsx b/web/src/pages/add-knowledge/components/knowledge-chunk/components/document-preview/preview.tsx index 54b204602d9..6bce02396d5 100644 --- a/web/src/pages/add-knowledge/components/knowledge-chunk/components/document-preview/preview.tsx +++ b/web/src/pages/add-knowledge/components/knowledge-chunk/components/document-preview/preview.tsx @@ -32,7 +32,6 @@ const HighlightPopup = ({ // TODO: merge with DocumentPreviewer const Preview = ({ highlights: state, setWidthAndHeight }: IProps) => { const url = useGetDocumentUrl(); - useCatchDocumentError(url); const ref = useRef<(highlight: IHighlight) => void>(() => {}); const error = useCatchDocumentError(url); @@ -119,12 +118,4 @@ const Preview = ({ highlights: state, setWidthAndHeight }: IProps) => { ); }; -const compare = (oldProps: IProps, newProps: IProps) => { - const arePropsEqual = - oldProps.highlights === newProps.highlights || - (oldProps.highlights.length === 0 && newProps.highlights.length === 0); - - return arePropsEqual; -}; - export default memo(Preview);