Skip to content

[PB-6592] bugfix/Fix Photos timeline scroll position when open Photos#523

Open
CandelR wants to merge 1 commit into
feature/PB-6593-device-filterfrom
bugfix/PB-6592-fix-timeline-incorrect-position
Open

[PB-6592] bugfix/Fix Photos timeline scroll position when open Photos#523
CandelR wants to merge 1 commit into
feature/PB-6593-device-filterfrom
bugfix/PB-6592-fix-timeline-incorrect-position

Conversation

@CandelR

@CandelR CandelR commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Whenn opening Photos (cold start, or after switching the device filter) landed the timeline mid-way on an old date instead of showing the most recent photos at the top.

Root cause: @shopify/flash-list v2 ships maintainVisibleContentPosition enabled by default, which anchors scroll to whatever is already on screen. Since our timeline is always sorted newest-first, whenever local/cloud data resolved asynchronously and reordered the top of the list, that anchoring kept the user pinned to old content instead of showing the new top.

Main fixes:

  • PhotosTimeline.tsx: disable maintainVisibleContentPosition on the FlashList, and add scrollToTop to the imperative handle.
  • index.tsx: force scrollToTop() whenever the device filter changes.
  • useCloudAssets.ts: clear the previous filter's cloudItems before firing the new query, so switching devices doesn't briefly show the old device's photos.
  • useLocalAssets.ts / usePhotosTimeline.ts: new hasLoadedLocalAssetsOnce flag that withholds cloud items until local assets have loaded once, avoiding a flash of stale cloud-only content on the first cold-start render.

@CandelR CandelR requested a review from larryrider July 7, 2026 15:25
@CandelR CandelR self-assigned this Jul 7, 2026
@CandelR CandelR added the bug Something isn't working label Jul 7, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants