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)
Sat, Oct 5, 12:47 AM
Unknown Object (File)
Thu, Sep 19, 3:23 PM
Unknown Object (File)
Thu, Sep 19, 3:20 PM
Unknown Object (File)
Thu, Sep 19, 3:20 PM
Unknown Object (File)
Thu, Sep 19, 3:20 PM
Unknown Object (File)
Tue, Sep 17, 4:34 PM
Unknown Object (File)
Sep 1 2024, 12:38 AM
Unknown Object (File)
Aug 25 2024, 12:32 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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