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)
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
Unknown Object (File)
Sun, Nov 3, 7:41 PM
Unknown Object (File)
Sun, Nov 3, 7:23 PM
Unknown Object (File)
Oct 13 2024, 10:15 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
Branch
arcpatch-D9052 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

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.