Page MenuHomePhabricator

[web] Simplify media gallery hooks
ClosedPublic

Authored by bartek on May 26 2023, 1:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 19, 6:22 PM
Unknown Object (File)
Wed, Jun 19, 6:22 PM
Unknown Object (File)
Wed, Jun 19, 6:20 PM
Unknown Object (File)
Wed, Jun 19, 8:59 AM
Unknown Object (File)
Fri, Jun 14, 12:58 PM
Unknown Object (File)
Mon, Jun 10, 7:22 PM
Unknown Object (File)
Sun, Jun 9, 11:41 AM
Unknown Object (File)
May 24 2024, 6:24 PM
Subscribers

Details

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)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable