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
F3197039: D3769.id11753.diff
Sat, Nov 9, 7:10 AM
F3185278: D3769.id11650.diff
Fri, Nov 8, 12:44 PM
F3185276: D3769.id.diff
Fri, Nov 8, 12:44 PM
F3182111: D3769.id.diff
Fri, Nov 8, 7:30 AM
Unknown Object (File)
Thu, Nov 7, 7:16 PM
Unknown Object (File)
Wed, Nov 6, 11:40 AM
Unknown Object (File)
Wed, Nov 6, 11:40 AM
Unknown Object (File)
Sat, Nov 2, 4:23 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.