-
Notifications
You must be signed in to change notification settings - Fork 73
feat: improve splitview horizontal image pairing #568
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
base: main
Are you sure you want to change the base?
Conversation
- Pass clientIdentifier to getAsset() for better logging/tracking - Add selectAssetsForDisplay() to look ahead 3 images when pairing - Skip lone horizontal images by checking if 2nd or 3rd can pair - Extract removeAtIndices() helper for cleaner array manipulation
📝 WalkthroughWalkthroughHome page asset loading now includes a clientIdentifier and replaces backlog/history batching with candidate-based selection and orientation-aware display logic via new helpers that pick and remove asset indices and update portrait detection. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 1
🤖 Fix all issues with AI agents
In `@immichFrame.Web/src/lib/components/home-page/home-page.svelte`:
- Around line 217-251: The pairing logic is inverted because isHorizontal()
currently returns imageHeight > imageWidth (true for portrait), causing
selectAssetsForDisplay() (variables h0, h1, h2 and checks like if (!h0), if
(h1), etc.) to treat portrait images as "horizontal"; fix by changing
isHorizontal() to return imageWidth > imageHeight so its boolean matches its
name and the intended pairing logic, then run/adjust any comments or tests
referencing isHorizontal() behavior to reflect the corrected orientation
semantics.
The function was incorrectly named - it checks if height > width, which means portrait orientation, not horizontal/landscape. Renamed to isPortrait and updated variable names and comments to accurately reflect the behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Problem: The original splitview logic only paired horizontal images if they were adjacent (positions 0 and 1). If a vertical image was between two horizontal ones, the first horizontal would display alone, looking awkward.
Summary
Drive by fix
isHorizontal()function actually checked ifheight > width(portrait orientation). Renamed toisPortrait()for clarity.Details
Solution: New
selectAssetsForDisplay()function with smarter logic:This improves the visual experience by maximizing horizontal pairings and avoiding lone horizontal images in splitview.
Open question/discussion
I was thinking about making this configurable for back compat reasons, by adding a "splitview-forced" option for layout, but that felt like overkill and I struggle to think of a valid use case for wanting to keep the "sometimes splitview shows a lone portrait item" behaviour. So opted to just change the default behavior for all "splitview"
Summary by CodeRabbit
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.