Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Deploying drive-web with
|
| Latest commit: |
80e134a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://96a37720.drive-web.pages.dev |
| Branch Preview URL: | https://feat-pb-7047-photos-infinite.drive-web.pages.dev |
|
| const monthKeys = useMemo(() => getMonthKeysNewestFirst(months), [months]); | ||
| const lastShownMonth = monthKeys[shownMonthsCount - 1]; | ||
| const hasMoreMonths = shownMonthsCount < monthKeys.length; | ||
| const shouldShowNextMonth = isEndOfTimelineNear && status === 'loaded' && hasMoreMonths; |
There was a problem hiding this comment.
shouldShowNextMonth triggers on proximity to viewport (800px), not on actual scroll. If loaded photos render shorter than viewport + 800px, this is already true on mount, so shownMonthsCount keeps incrementing and every remaining month loads back-to-back at mount instead of progressively. The PR's own new test shows all three months rendered with no fireEvent.scroll anywhere.
Maybe you could gate the effect on a real scroll/interaction signal, or only allow it after the first user scroll
event, or something like that 🤔
|
|
||
| export type TimelineStatus = 'loading' | 'error' | 'loaded'; | ||
|
|
||
| const getMonthKeysNewestFirst = (months: PhotoMonth[]): MonthKey[] => |
There was a problem hiding this comment.
getMonthKeysNewestFirst duplicates the dedupe+sort-newest-first logic already in usePhotoFilters.ts (availableMonths) and photoFolders.service.ts (getDeviceMonths). Three copies of the same [...new Set(...)].sort(...) that can drift out of sync
maybe extract this into a shared helper (e.g. getUniqueMonthKeysNewestFirst in ../types.ts or a new
monthKeys.ts util) and have both useTimelinePhotos.ts and usePhotoFilters.ts's availableMonths call it, instead of keeping two copies of the same dedupe+sort logic:
export const getUniqueMonthKeysNewestFirst = (months: PhotoMonth[]): MonthKey[] => [...new Set(months.map((month) => month.key))].sort((a, b) => b.localeCompare(a));
There was a problem hiding this comment.
I like that! Good idea



Description
The Photos gallery now shows every month instead of only the newest one. It starts with the newest month and, as the user scrolls down, the month before it is loaded and shown below, until all the photos have been shown. While a month is loading, a placeholder grid is shown under the photos already on screen. If a month cannot be loaded, the photos above stay on screen and the user can try again.
When the user picks a month in the date filter, only that month is shown, as before.
Related Issues
Jira: PB-7047 (parent PB-6876)
Related Pull Requests
Checklist
Testing Process
Additional Notes
The page is still not linked from the sidebar.