mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-07-31 02:41:59 +08:00
Fix: Every time you switch the page number of a chunk, the PDF document will be reloaded. #4046 (#4047)
### What problem does this PR solve? Fix: Every time you switch the page number of a chunk, the PDF document will be reloaded. #4046 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
7fb67c4f67
commit
8ea631a2a0
@ -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({
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user