-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Sync-scrolling multiple panels stops at bottom of shortest panel when scrolling down #3024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughRefactors the multi-panel wrapper reference from React.createRef() to a callback ref, consolidating wheel event listener attachment and detachment logic within a dedicated class method. Updates all component lifecycle and rendering logic to use the new callback-based ref pattern. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/dashboard/Data/Browser/DataBrowser.react.js (3)
172-183: Wheel listener lifecycle insetMultiPanelWrapperReflooks sound; consider centralizing listener togglingStoring the wrapper element and always removing the previous listener before attaching to the new one is correct and prevents leaks when the DOM node changes. However, attachment/detachment is now split between this method and
componentDidUpdate, which makes the lifecycle harder to reason about.You could simplify by centralizing the “does this component currently need a wheel listener?” decision into a single helper (e.g.
updateWrapperWheelListener()) that bothsetMultiPanelWrapperRefandcomponentDidUpdatecall, so the add/remove rules live in one place.
247-252: Good unmount cleanup; optionally clear pending wheel timeoutRemoving the
wheellistener frommultiPanelWrapperElementon unmount is correct and avoids leaks. One small follow‑up: ifthis.wheelTimeoutis still pending when the component unmounts, you could clear it here to avoid running a timeout callback after unmount (even though it only mutates an instance field):componentWillUnmount() { document.body.removeEventListener('keydown', this.handleKey); window.removeEventListener('resize', this.updateMaxWidth); if (this.multiPanelWrapperElement) { this.multiPanelWrapperElement.removeEventListener('wheel', this.handleWrapperWheel); } + if (this.wheelTimeout) { + clearTimeout(this.wheelTimeout); + this.wheelTimeout = null; + } }
319-330: Avoid duplicating wheel-listener attach/detach logic between lifecycle and refThis conditional correctly responds to changes in
panelCount/syncPanelScrolland (re)attaches or removes the wheel listener as needed when state changes. However, similar add/remove logic already exists insetMultiPanelWrapperRef, so the responsibility is now split between two places.To reduce complexity and the risk of future drift, consider:
- Having
setMultiPanelWrapperRefonly updatethis.multiPanelWrapperElement, with no listener logic, and- Moving all listener management into a single helper invoked from
componentDidMount/componentDidUpdate/componentWillUnmount.That way, any future change in when the listener should be active only needs to be updated once.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/dashboard/Data/Browser/DataBrowser.react.js(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Node 18
- GitHub Check: Docker linux/amd64
🔇 Additional comments (1)
src/dashboard/Data/Browser/DataBrowser.react.js (1)
1453-1457: Callback ref usage formultiPanelWrapperis correct and aligns with new helperSwitching the wrapper’s
reftothis.setMultiPanelWrapperRefis consistent with the newmultiPanelWrapperElementfield and ensures you always have the live DOM element when the multi‑panel container mounts/unmounts. This integrates cleanly with the wheel‑listener lifecycle you’ve added.
# [8.1.0-alpha.4](8.1.0-alpha.3...8.1.0-alpha.4) (2025-11-26) ### Bug Fixes * Sync-scrolling multiple panels stops at bottom of shortest panel when scrolling down ([#3024](#3024)) ([bf46938](bf46938))
|
🎉 This change has been released in version 8.1.0-alpha.4 |
New Pull Request Checklist
Issue Description
Sync-scrolling multiple panels stops at bottom of shortest panel when scrolling down.
Approach
Fix scroll position algorithm.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.