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, Dec 14, 12:38 AM
Unknown Object (File)
Nov 27 2024, 2:15 AM
Unknown Object (File)
Nov 23 2024, 10:01 AM
Unknown Object (File)
Nov 23 2024, 7:35 AM
Unknown Object (File)
Nov 17 2024, 1:37 AM
Unknown Object (File)
Nov 13 2024, 12:49 PM
Unknown Object (File)
Nov 7 2024, 10:45 PM
Unknown Object (File)
Nov 5 2024, 1:47 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