Page MenuHomePhabricator

[web] Move `onChangeAccountPassword` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
ClosedPublic

Authored by atul on Apr 18 2022, 3:25 PM.
Tags
None
Referenced Files
F3354109: D3769.diff
Sat, Nov 23, 11:47 AM
F3348203: D3769.id11753.diff
Fri, Nov 22, 2:01 PM
F3348202: D3769.id11752.diff
Fri, Nov 22, 2:01 PM
F3348201: D3769.id11578.diff
Fri, Nov 22, 2:01 PM
F3348200: D3769.id11650.diff
Fri, Nov 22, 2:01 PM
F3348183: D3769.id.diff
Fri, Nov 22, 2:01 PM
F3348167: D3769.diff
Fri, Nov 22, 1:59 PM
Unknown Object (File)
Wed, Nov 13, 10:42 AM

Details

Summary

Move onChangeAccountPassword out from inner class component to outer "Connected" functional component.

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


Depends on D3768

Test Plan
  1. Open ThreadSettingsModal
  2. Change account password under delete tab
  3. Log values in onChangeAccountPassword to ensure that the state continues to change as expected

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul requested review of this revision.Apr 18 2022, 3:30 PM
tomek added inline comments.
web/modals/threads/thread-settings-modal.react.js
457–463

When a callback doesn't depend on anything, we can define the function outside the component. But on the other hand, it will break the flow of the code, so it's not necessarily worth it.

This revision is now accepted and ready to land.Apr 21 2022, 3:11 AM
web/modals/threads/thread-settings-modal.react.js
457–463

Even though there aren't any dependencies, doesn't using React.useCallback provide referential equality when passed to the inner ThreadSettingsModal class component?

web/modals/threads/thread-settings-modal.react.js
457–463

When a function is defined in global scope, it never changes and is always equal to itself. It's true that callback provide the equality, but it is only needed when a function is redefined, e.g. in render function.