HomePhabricator
Diffusion Comm 8d7d06692226

[web] Simplify media gallery hooks

Description

[web] Simplify media gallery hooks

Summary:
I noticed that the previous gallery logic had a dependency chain of useMemo hooks:
filteredMediaInfos -> mediaCoverPhotos -> mediaGalleryItems. This might be inefficient. If one dependency changes, all of them are fired.
Here is the React docs section on hook chains (with useEffect examples): https://react.dev/learn/you-might-not-need-an-effect#chains-of-computations

Merged all of these into one hook.

Depends on D7995

Test Plan: Media gallery works as before (repeat test plan from D7995)

Reviewers: atul, inka, ginsu, tomek

Reviewed By: atul

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D7996

Details

Provenance
bartekAuthored on May 26 2023, 12:50 AM
Reviewer
atul
Differential Revision
D7996: [web] Simplify media gallery hooks
Parents
rCOMM54645791eab3: [web] Fix thread gallery for encrypted media
Branches
Unknown
Tags
Unknown