Skip to content

fix(web): remount chunk virtual list when result set changes - #19940

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/chunk-virtual-list-stale-heights
Sep 20, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/chunk-virtual-list-stale-heights

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

Extract the virtualizer into a ChunkVirtualList component remounted through a key derived from the rendered chunk-id sequence, replacing the previous dataUpdatedAt-based remount. This fixes two issues:

  • Background refetches that return the same chunks no longer reset scroll position, since the list key is unchanged.
  • New search/filter/page results get a fresh virtualizer, so stale per-index measured heights from the previous result set no longer make cards overlap.

Also bump the item size estimate from 120 to 180, key virtual items by chunk_id via getItemKey, and drop the unused dataUpdatedAt prop passed into ChunkCard.

Extract the virtualizer into a `ChunkVirtualList` component remounted
through a key derived from the rendered chunk-id sequence, replacing
the previous `dataUpdatedAt`-based remount. This fixes two issues:

- Background refetches that return the same chunks no longer reset
  scroll position, since the list key is unchanged.
- New search/filter/page results get a fresh virtualizer, so stale
  per-index measured heights from the previous result set no longer
  make cards overlap.

Also bump the item size estimate from 120 to 180, key virtual items
by `chunk_id` via `getItemKey`, and drop the unused `dataUpdatedAt`
prop passed into `ChunkCard`.
@dcc123456
dcc123456 requested a review from wangq8 September 20, 2026 11:10
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Sep 20, 2026
@dcc123456
dcc123456 marked this pull request as draft September 20, 2026 11:11
@dcc123456
dcc123456 marked this pull request as ready for review September 20, 2026 11:11
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b767dd4e-eafb-43d7-9445-eb8e2bde63f9

📥 Commits

Reviewing files that changed from the base of the PR and between de989f2 and f8793b7.

📒 Files selected for processing (1)
  • web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx
 _________________________________________________________________
< I am below the bugs. I am above the bugs. I am around the bugs. >
 -----------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8
wangq8 merged commit 8254f33 into infiniflow:main Sep 20, 2026
9 of 11 checks passed
jay77721 added a commit to jay77721/ragflow that referenced this pull request Sep 23, 2026
Uploading or replacing an image in the chunk edit dialog only invalidated
the chunk list, so the previous picture stayed on screen until the page
was reloaded:

- Image caches fetched bytes in a module-level map keyed by the request
  URL, and a chunk keeps its img_id when its image is changed in place,
  so that URL never changed.
- The chunk card still takes a cache-busting `t` prop (forwarded to the
  image URL as `_t`), but the virtual list rendering it stopped passing
  one when it was extracted (infiniflow#19940). The list's `dataUpdatedAt` reaches
  the card again, so cards re-fetch the new bytes after an update.
- The edit dialog preview is served by the same cache, so a successful
  update now evicts the cached bytes of the chunk it touched
  (evictDocumentImage), which also revokes the stale blob URL.

Tests: image-cache.test.tsx pins cache reuse, eviction and the `_t`
keying; use-chunk-request-image-eviction.test.tsx pins that a successful
update drops the cached image (it expects a second fetch and gets one
without the eviction call).

Verified: oxfmt/oxlint clean, tsc --noEmit reports no error in the
touched files, both new suites pass.

Co-authored-by: CommandCodeBot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants