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
F3353501: D3759.id11557.diff
Sat, Nov 23, 10:01 AM
F3353002: D3759.diff
Sat, Nov 23, 7:35 AM
Unknown Object (File)
Sun, Nov 17, 1:37 AM
Unknown Object (File)
Wed, Nov 13, 12:49 PM
Unknown Object (File)
Thu, Nov 7, 10:45 PM
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

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
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

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

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

Personally I think it's probably fine