Skip to content

[PB-7047]: feat/keep showing older months as the user scrolls - #2294

Open
xabg2 wants to merge 1 commit into
feat/PB-7047-photos-thumbnailsfrom
feat/PB-7047-photos-infinite-scroll
Open

xabg2 wants to merge 1 commit into
feat/PB-7047-photos-thumbnailsfrom
feat/PB-7047-photos-infinite-scroll

Conversation

@xabg2

@xabg2 xabg2 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

  • Unit tests cover the photos of every month being shown day by day, newest first, a single month being shown when it is picked in the filter, and an older month that fails to load keeping the newer photos on screen and loading after trying again.

Additional Notes

The page is still not linked from the sidebar.

@xabg2 xabg2 added the enhancement New feature or request label Nov 6, 2026
@xabg2 xabg2 self-assigned this Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fe0d7f7a-5ec8-4768-bd90-37faff8a523d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

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

View logs

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@xabg2
xabg2 marked this pull request as ready for review November 6, 2026 14:03
const monthKeys = useMemo(() => getMonthKeysNewestFirst(months), [months]);
const lastShownMonth = monthKeys[shownMonthsCount - 1];
const hasMoreMonths = shownMonthsCount < monthKeys.length;
const shouldShowNextMonth = isEndOfTimelineNear && status === 'loaded' && hasMoreMonths;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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[] =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that! Good idea

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants