feat(data-log): stable item key for live anchor + scroll-to-top button#39
Merged
Conversation
…logs Replace the 2-virtual-slots-per-log approach with a single slot per log. Each virtual item now contains an inner sticky DataRow header and a RowDetails panel below it. Using `top` instead of `transform` on the outer wrapper ensures `position: sticky` works correctly relative to the scroll container. Removes: activeStickyIndexRef, isSticky/isActiveSticky helpers, custom rangeExtractor, and useIsLogOpen usage in DataLog.
Key live scroll anchor with log ID via getItemKey so TanStack Virtual's size cache survives prepends. Eliminates ResizeObserver correction cycles and visible scroll jumps when expanded detail panels are in view. Step 2 now reads anchorItem.start directly instead of estimating delta * 35, since measurements are accurate immediately after prepend. Add a scroll-to-top button (top-right, visible when scrolled > 200 px) that jumps scrollTop to 0 instantly to avoid virtualization mid-scroll issues. Uses react-use useScroll for scroll position tracking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getItemKeynow keys TanStack Virtual's size cache by log ID instead of index. After a live prepend, existing measurements (including open detail panels) are immediately accurate — no ResizeObserver correction cycles, no visible scroll jumps.anchorItem.startdirectly instead of estimatingdelta * 35, since measurements are now accurate from the first render.react-use'suseScrollfor tracking. JumpsscrollTopto 0 instantly (smooth scroll breaks with virtualization due to mid-scroll re-renders).Test plan