Page MenuHomePhabricator

[lib/native] introduce useIsKeyserverURLValid hook
ClosedPublic

Authored by ginsu on Oct 31 2023, 9:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 6, 2:51 AM
Unknown Object (File)
Fri, Jul 5, 9:14 PM
Unknown Object (File)
Fri, Jul 5, 6:10 PM
Unknown Object (File)
Tue, Jul 2, 2:44 PM
Unknown Object (File)
Tue, Jul 2, 1:43 PM
Unknown Object (File)
Tue, Jul 2, 11:29 AM
Unknown Object (File)
Tue, Jul 2, 10:53 AM
Unknown Object (File)
Sun, Jun 30, 11:53 PM
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
Lint Not Applicable
Unit
Tests Not Applicable

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.