[web][photos] update album cover image#9228
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 651394ee1d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| : state.collectionFiles.filter( | ||
| ({ collectionID }) => | ||
| collectionID === activeCollection.id, | ||
| ), |
There was a problem hiding this comment.
Derive cover picker files from filtered album state
The cover picker is built from state.collectionFiles filtered only by collectionID, which bypasses the reducer’s active-view filtering (deriveAlbumsOrHiddenAlbumsFilteredFiles) that removes temp-deleted/temp-hidden items before they disappear from local state. In flows where a file has been removed/hidden but the collection cache is stale, the dialog can still offer that file and then send an invalid coverID, causing cover updates to fail. Building this list from the same filtered source as the visible album avoids selecting stale candidates.
Useful? React with 👍 / 👎.
| const annotatedFiles = useMemo( | ||
| (): FileListAnnotatedFile[] => | ||
| files | ||
| .filter((file) => file.metadata.fileType !== FileType.video) | ||
| .map((file) => ({ |
There was a problem hiding this comment.
Defer cover picker annotation until dialog opens
This memo eagerly computes timeline annotations for every file in the active collection even when the dialog is closed; combined with the parent always mounting PickCoverPhotoDialog for any activeCollection, switching into large albums now does an unnecessary full-file pass and date formatting work. Deferring this computation until open is true (or mounting the dialog only when open) avoids a measurable per-album performance hit for users who never invoke “Set cover.”
Useful? React with 👍 / 👎.
No description provided.