Page MenuHomePhabricator

[native] Add some memoization to InnerRobotextMessage
ClosedPublic

Authored by ashoat on Feb 1 2023, 1:59 PM.
Tags
None
Referenced Files
F3504966: D6504.id21799.diff
Fri, Dec 20, 11:38 AM
F3504957: D6504.id21874.diff
Fri, Dec 20, 11:33 AM
F3503766: D6504.diff
Fri, Dec 20, 6:34 AM
Unknown Object (File)
Nov 18 2024, 7:25 PM
Unknown Object (File)
Nov 14 2024, 8:16 PM
Unknown Object (File)
Oct 29 2024, 4:21 PM
Unknown Object (File)
Oct 29 2024, 4:21 PM
Unknown Object (File)
Oct 29 2024, 4:20 PM
Subscribers

Details

Summary
  1. Memoizing textParts will prevent their parent Text from rerendering when unnecessary
  2. Wrapping the whole component with React.memo brings it back to parity with the old PureComponent implementation
Test Plan

Flow, making sure robotext messages still render on native

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat requested review of this revision.Feb 1 2023, 2:15 PM
This revision is now accepted and ready to land.Feb 2 2023, 10:34 AM
native/chat/inner-robotext-message.react.js
152–159

(I loosely remember something about exporting multiple things from a file with a React component could lead to issues with hot reloading or something?)

native/chat/inner-robotext-message.react.js
152–159

It's actually fine if both are React components – see here

native/chat/inner-robotext-message.react.js
152–159

Ah gotcha, thanks for clarifying + linking to that