Page MenuHomePhabricator

[native] Move componentDidUpdate logic in MultimediaMessageMultimedia to functional component
ClosedPublic

Authored by angelika on Wed, Dec 11, 12:35 PM.
Tags
None
Referenced Files
F3489949: D14134.diff
Wed, Dec 18, 2:14 PM
Unknown Object (File)
Tue, Dec 17, 8:51 PM
Unknown Object (File)
Fri, Dec 13, 9:54 PM
Subscribers
None

Details

Summary

Move the logic in componentDidUpdate to a functional component, that is: if the scroll in overlay context is now disabled and it wasn't disabled before, then call setClickable(true). Or in more human way: if a modal that was previously blocking scroll etc. disappeared then the message with the multimedia is clickable again.

Depends on D14133

Test Plan

Open a modal (a tooltip or click a message with an image)
Close a modal
Click on a message with an image
Verify the image is expanded

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

angelika held this revision as a draft.

Accepting so I don't block you, but please make sure you've considered whether there's any risks associated with this effect potentially being run on mount

native/chat/multimedia-message-multimedia.react.js
205–212

Will this effect run on mount? I noticed in the old class component, there is no componentDidMount, so technically the behavior may be different if this effect can run on mount. Even if the effect runs on mount, there might be no problem... just wondering if you've thought about this

This revision is now accepted and ready to land.Wed, Dec 11, 8:10 PM

Rebase and address feedback

native/chat/multimedia-message-multimedia.react.js
205–212

The effect will run on mount, but scrollWasDisabled will be undefined so props.setClickable won't be called. All it does on the first render is setting scrollWasDisabled.

native/chat/multimedia-message-multimedia.react.js
205–212

Thanks for the analysis!