fixes the details page (#21776)

fixes: https://github.com/keycloak/keycloak/issues/15344#issuecomment-1636965834
This commit is contained in:
Erik Jan de Wit 2023-07-20 20:15:03 +02:00 committed by GitHub
parent 7c9593f88a
commit 262cc33ebd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,13 +164,22 @@ export default function DetailSettings() {
const [selectedMapper, setSelectedMapper] =
useState<IdPWithMapperAttributes>();
const serverInfo = useServerInfo();
const providerInfo = useMemo(
() =>
serverInfo.componentTypes?.[
"org.keycloak.broker.social.SocialIdentityProvider"
]?.find((p) => p.id === providerId),
[serverInfo, providerId],
);
const providerInfo = useMemo(() => {
const namespaces = [
"org.keycloak.broker.social.SocialIdentityProvider",
"org.keycloak.broker.provider.IdentityProvider",
];
for (const namespace of namespaces) {
const social = serverInfo.componentTypes?.[namespace]?.find(
({ id }) => id === providerId,
);
if (social) {
return social;
}
}
}, [serverInfo, providerId]);
const { addAlert, addError } = useAlerts();
const navigate = useNavigate();