mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
fix double-fetch of cred types in launch prompts
This commit is contained in:
parent
af18aa8456
commit
7827a2aedd
@ -24,7 +24,6 @@ function CredentialsStep({ i18n }) {
|
||||
const [selectedType, setSelectedType] = useState(null);
|
||||
const history = useHistory();
|
||||
|
||||
const isTypeSelected = !!selectedType;
|
||||
const {
|
||||
result: types,
|
||||
error: typesError,
|
||||
@ -33,13 +32,13 @@ function CredentialsStep({ i18n }) {
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const loadedTypes = await CredentialTypesAPI.loadAllTypes();
|
||||
if (!isTypeSelected && loadedTypes.length) {
|
||||
if (loadedTypes.length) {
|
||||
const match =
|
||||
loadedTypes.find(type => type.kind === 'ssh') || loadedTypes[0];
|
||||
setSelectedType(match);
|
||||
}
|
||||
return loadedTypes;
|
||||
}, [isTypeSelected]),
|
||||
}, []),
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user