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
Unknown Object (File)
Wed, Dec 25, 12:52 PM
Unknown Object (File)
Wed, Dec 25, 12:52 PM
Unknown Object (File)
Wed, Dec 25, 12:52 PM
Unknown Object (File)
Wed, Dec 25, 12:52 PM
Unknown Object (File)
Wed, Dec 25, 12:52 PM
Unknown Object (File)
Wed, Dec 25, 12:50 PM
Unknown Object (File)
Nov 27 2024, 7:54 AM
Unknown Object (File)
Nov 23 2024, 2:10 PM

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
Branch
master
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 ↗(On Diff #11650)

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 ↗(On Diff #11650)

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 ↗(On Diff #11650)

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.