Page MenuHomePhabricator

[web] Move `currentTabType` state up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
ClosedPublic

Authored by atul on Apr 18 2022, 11:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 1:47 AM
Unknown Object (File)
Sun, Nov 3, 1:26 PM
Unknown Object (File)
Sun, Nov 3, 1:26 PM
Unknown Object (File)
Sun, Nov 3, 1:26 PM
Unknown Object (File)
Sat, Nov 2, 9:43 AM
Unknown Object (File)
Thu, Oct 10, 2:51 AM
Unknown Object (File)
Thu, Oct 10, 2:51 AM
Unknown Object (File)
Thu, Oct 10, 2:51 AM

Details

Summary

Move currentTabType state out of the inner class component state, and move it out to the wrapping "Connected" functional component.

As part of the work to refactor ThreadSettingsModal… specifically to turn it into a functional component.


Depends on D3757

Test Plan

Close reading... should be a noop

Will test the entirety of ThreadSettingsModal thoroughly once the refactor is complete (plan on using this as an opportunity to write some automated tests)

Diff Detail

Repository
rCOMM Comm
Branch
apr19 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul requested review of this revision.Apr 18 2022, 11:25 AM
tomek added inline comments.
web/modals/threads/thread-settings-modal.react.js
393–395 ↗(On Diff #11557)

This is probably fine, but we can consider some alternatives to calling an excessive number of functions:

  1. We can have one useState which would have an object instead of a separate state for each prop
  2. We can useReducer

Not sure if it's worth changing - these are just ideas

This revision is now accepted and ready to land.Apr 19 2022, 3:41 AM
web/modals/threads/thread-settings-modal.react.js
393–395 ↗(On Diff #11557)

Definitely agree that there's room for cleaning things up here. Tried to keep the state "apart" for ease of refactoring, but once the state/functionality is pushed down to the relevant ThreadSetting[General/Privacy/Delete]Modals I'll take another pass and see if there are things that can be consolidated/cleaned up/etc.

web/modals/threads/thread-settings-modal.react.js
393–395 ↗(On Diff #11557)

Personally I think it's probably fine