Page MenuHomePhabricator

[lib/native] introduce useIsKeyserverURLValid hook
ClosedPublic

Authored by ginsu on Oct 31 2023, 9:53 PM.
Tags
None
Referenced Files
F3371378: D9666.id32582.diff
Tue, Nov 26, 4:44 AM
F3369732: D9666.id32987.diff
Mon, Nov 25, 11:28 PM
Unknown Object (File)
Mon, Nov 25, 12:15 AM
Unknown Object (File)
Sat, Nov 23, 4:40 AM
Unknown Object (File)
Sat, Nov 23, 3:57 AM
Unknown Object (File)
Sat, Nov 23, 12:39 AM
Unknown Object (File)
Fri, Nov 8, 12:02 PM
Unknown Object (File)
Fri, Nov 8, 11:11 AM
Subscribers

Details

Summary

To validate that the keyserver url the user inputted into the add keyserver input exists we should call the getVersion endpoint. The logic for this actually already exists in the KeyserverSelection component in the new registation flow. This diff factors out the shared logic into a seperate hook called useIsKeyserverURLValid.

Linear task: https://linear.app/comm/issue/ENG-5337/factor-out-shared-validation-logic-in-the-onsubmit-callback-in

Depends on D9665

Test Plan

Followed the test plan in D8198 and made sure that there were no regressions

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/account/registration/keyserver-selection.react.js
94 ↗(On Diff #32583)

Why was this change made?

126–128 ↗(On Diff #32583)

This condition doesn't appear to have been "migrated" to the new function. The button should be disabled if keyserverURL isn't set, but it's still good to be safe in case there is a race condition where the input is cleared and then the button is pressed before the button state updates

native/account/registration/keyserver-selection.react.js
94 ↗(On Diff #32583)

I initially had the keyserverURL param in useIsKeyserverURLValid be required; however, based on other inline comment, I will make it optional and bring the !keyserverURL condition into useIsKeyserverURLValid

This revision is now accepted and ready to land.Nov 2 2023, 7:00 AM

update after @inka's recently landed diffs

This revision was landed with ongoing or failed builds.Dec 4 2023, 10:31 PM
This revision was automatically updated to reflect the committed changes.