Page MenuHomePhabricator

[native] Convert `ComposedMessage` into a functional component
ClosedPublic

Authored by atul on Aug 31 2023, 8:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Aug 28, 3:47 AM
Unknown Object (File)
Wed, Aug 28, 3:47 AM
Unknown Object (File)
Wed, Aug 28, 3:47 AM
Unknown Object (File)
Wed, Aug 28, 3:47 AM
Unknown Object (File)
Wed, Aug 28, 3:44 AM
Unknown Object (File)
Mon, Aug 26, 3:42 PM
Unknown Object (File)
Mon, Aug 26, 11:44 AM
Unknown Object (File)
Sun, Aug 25, 1:06 PM
Subscribers

Details

Summary

This allows us to memoize things in a more precise way and reduces some re-renders of child components.


Depends on D9051

Test Plan

ComposedMessage continues to behave as expected. A little more "gray" in the flamegraph (components aren't re-rendering), but nothing super impactful. Hopefully there will be more significant improvements in conjunction w/ subsequent diffs.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul retitled this revision from [native] Turn `ComposedMessage` into a functional component to [native] Convert `ComposedMessage` into a functional component.Aug 31 2023, 8:52 AM
atul published this revision for review.Aug 31 2023, 8:55 AM
tomek added inline comments.
native/chat/composed-message.react.js
151–158 ↗(On Diff #30661)

This can be made a lot more efficient by using inputState?.editInputMessage as a dependency

217–219 ↗(On Diff #30661)

You can use a shorthand

319–353 ↗(On Diff #30661)

Not sure if this is really beneficial to memoize the return value in React.memo especially when so many dependencies are used.

This revision is now accepted and ready to land.Sep 1 2023, 3:48 AM
atul marked 2 inline comments as done.

address @tomek's feedback

This revision was landed with ongoing or failed builds.Sep 5 2023, 11:27 AM
This revision was automatically updated to reflect the committed changes.