Auto scroll to show this item when its tab becomes active#6080
Auto scroll to show this item when its tab becomes active#6080bijin-bruno merged 4 commits intousebruno:mainfrom
Conversation
|
@dssagar93 Thanks for the PR! Would you mind sharing a short demo video to showcase the feature in action? |
|
Hi @helloanoop, sure, here you go, added a small clip to showcase the feature Video.Project.Crop.mp4 |
|
Also, here's what happens right now in the current release build -- without the fix Video.Original.Crop.mp4 |
|
@Pragadesh44-Bruno , @lohit-bruno , @helloanoop - can somebody review it please? Thanks |
|
@dssagar93 Thanks for the PR! I will review this and share it with the team for further review and merging. |
|
@Pragadesh44-Bruno Sounds good. |
|
Hello folks, any reason or issues? What's with the holdup? @Pragadesh44-Bruno |
|
Rain check. Did you folks review it internally? Any updates? |
|
Hey @dssagar93 Just checked out your changes. Woeks like a charm 🔥 good work! @sreelakshmi-bruno Can we prioritise to get this merged in December? |
…roll-on-tab-change
WalkthroughAdds an auto-scroll effect to collection items in the sidebar that triggers when a tab becomes active. The effect scrolls the item into view with smooth behavior, wrapped in error handling for compatibility with environments lacking smooth scroll support. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js (1)
107-116: Auto-scroll effect looks correct; consider adding a non-smooth fallback.The effect correctly ties sidebar scrolling to
isTabForItemActiveand safely guards onref.current, which should satisfy the issue requirement without regressions.If you want slightly more robust behavior in environments that don’t support smooth scrolling, you could fall back to a basic
scrollIntoView()instead of doing nothing on error:useEffect(() => { if (isTabForItemActive && ref.current) { try { ref.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } catch (err) { - // ignore scroll errors (some environments may not support smooth scrolling) + // Fallback without smooth behavior if options aren't supported + try { + ref.current.scrollIntoView(); + } catch (_) { + // ignore if even the basic call is unsupported + } } } }, [isTabForItemActive]);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation, never tabs
Use single quotes for strings instead of double quotes
Always add semicolons at the end of statements
No trailing commas in code
Always use parentheses around parameters in arrow functions, even for single parameters
For multiline constructs, put opening braces on the same line with a minimum of 2 elements for multiline formatting
No newlines inside function parentheses
Space before and after the arrow in arrow functions:() => {}
No space between function name and parentheses:func()notfunc ()
Semicolons should go at the end of the line, not on a new line
Function names should be concise and descriptive
Add JSDoc comments to provide details to abstractions
Avoid single-line abstractions where all that is being done is increasing the call stack with one additional function
Add meaningful comments to explain complex code flow instead of obvious comments
Files:
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js (1)
packages/bruno-app/src/selectors/tab.js (2)
isTabForItemActive(3-5)isTabForItemActive(3-5)
fixes #6029
Description
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.