Page MenuHomePhabricator

[web] Push `onChange[Name/Description/Color]` callbacks down to `ThreadSettingsGeneralTab` component
ClosedPublic

Authored by atul on Apr 24 2022, 1:49 PM.
Tags
None
Referenced Files
F3168855: D3827.id11948.diff
Thu, Nov 7, 8:48 AM
F3167364: D3827.id11832.diff
Thu, Nov 7, 4:07 AM
F3167359: D3827.id.diff
Thu, Nov 7, 4:06 AM
Unknown Object (File)
Wed, Nov 6, 11:41 AM
Unknown Object (File)
Wed, Nov 6, 11:40 AM
Unknown Object (File)
Tue, Nov 5, 4:56 AM
Unknown Object (File)
Tue, Nov 5, 4:56 AM
Unknown Object (File)
Tue, Nov 5, 4:56 AM

Details

Summary

Push onChange[Name/Description/Color] callbacks down to the ThreadSettingsGeneralTab component to clean up parent ThreadSettingsModal component and move them closer to where they're used.

  • Added threadInfo, queuedChanges, and setQueuedChanges props to ThreadSettingsGeneralTab component so callbacks could be "constructed" from the "child" component
  • Adding those props also lets us determine threadDescriptionValue, etc within child component instead of having to pass in from parent

Depends on D3826

Test Plan
  1. Open ThreadSettingsModal
  2. Make sure that the "General" tab continues to look/work as expected

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

web/modals/threads/thread-settings-modal.react.js
135 ↗(On Diff #11832)

No longer need optional chaining because threadInfo is guaranteed to exist within ThreadSettingsGeneralTab

atul requested review of this revision.Apr 24 2022, 1:54 PM

access properties with obj.blah instead of obj['blah']

tomek added inline comments.
web/modals/threads/thread-settings-general-tab.react.js
31–44 ↗(On Diff #11833)

It's safer to use a callback version of set state. That would also allow us reducing deps list.

This revision is now accepted and ready to land.Apr 26 2022, 8:20 AM
web/modals/threads/thread-settings-general-tab.react.js
31–44 ↗(On Diff #11833)

actually rebase before landing