Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
JasonMillward
approved these changes
May 24, 2025
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.
Fixes #3313
Executive summary
So what is going on here?
The problem is that the ordering of the photos from the API is not necessarily the same as the ordering of the photos in the timeline. The timeline is constructed from the photos
taken_atdata and if not provided,created_atdata.This is split into different chunks based on the granularity. If the ordering is done by
created_at, and the order of the photos match, we do not have problems. But if one of the photos has a differenttaken_atdate, that does not match the order, then all the following photos are "moved" to different place which does not match the original index ordering.When we click on a photo, the index returned refers to the original ordering of the photos. As a result, if the timeline is enabled, we first do the split and then merge the photos so that the ordering is updated to reflect the timeline.
Note that this is not something that can be fixed in the backend as we would need to assume that all the dates are set properly. Furthermore, this would make the functionality unavailable if sorting by title is done. By doing it in the front-end, we are able to display the photos by blocks of time, and within the block, the ordering is done as expected.
Copilot summary
This pull request introduces significant changes to enhance the handling of photo timelines and improve the modularity of the codebase. The key updates include adding support for photo timelines in various components, refactoring timeline-related logic for better maintainability, and introducing new utility functions in the
splittermodule. Below is a categorized summary of the most important changes:Timeline Support and Refactoring
photosTimelineas a new prop to components likeAlbumPanel,PhotoThumbPanel, andResultPanelto support displaying photos grouped by timeline. This includes updating computed properties and templates to use the new timeline data. [1] [2] [3]mergefunction to reconstruct photos from timeline chunks and averifyOrderfunction for debugging timeline data integrity. [1] [2]Component Updates
PhotoThumbPanelListto replaceidxwithgroupIdxfor better clarity when working with grouped timeline data. Adjusted related logic for event handling and lazy loading. [1] [2]PhotoThumbPanelandAlbumThumbPanel, includingonMountedandwatchhooks to handle changes in album or timeline state. [1] [2]Utility Enhancements
splittermodule with new functions:mergefor combining split data back into a single array andverifyOrderfor ensuring timeline data matches the original photo order. These utilities improve the robustness of timeline handling.Service and API Adjustments
AlbumService.getmethod to handle different response structures, accommodating changes in how album data is retrieved.Codebase Integration
useAlbumRefreshercomposable, ensuring that photos and timelines are properly synchronized and merged when timelines are enabled. [1] [2]These changes collectively improve the user experience by introducing timeline-based photo organization while enhancing the maintainability and modularity of the codebase.