Page MenuHomePhabricator

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

Authored by atul on Aug 31 2023, 8:51 AM.
Tags
None
Referenced Files
F3370538: D9052.diff
Tue, Nov 26, 3:14 AM
F3364970: D9052.diff
Mon, Nov 25, 6:03 AM
Unknown Object (File)
Fri, Nov 22, 7:48 PM
Unknown Object (File)
Sat, Nov 9, 9:57 PM
Unknown Object (File)
Sat, Nov 9, 7:52 PM
Unknown Object (File)
Sun, Nov 3, 7:44 PM
Unknown Object (File)
Sun, Nov 3, 7:44 PM
Unknown Object (File)
Sun, Nov 3, 7:44 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.