Only load realms once and not on focus (#4015)

This commit is contained in:
Erik Jan de Wit 2023-01-03 11:33:16 -05:00 committed by GitHub
parent c9c8fe7317
commit 1155371439
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -163,13 +163,15 @@ export const RealmSelector = () => {
toggle={ toggle={
<DropdownToggle <DropdownToggle
data-testid="realmSelectorToggle" data-testid="realmSelectorToggle"
onToggle={() => setOpen(!open)} onToggle={() => {
if (realms.length === 0) refresh();
setOpen(!open);
}}
className="keycloak__realm_selector_dropdown__toggle" className="keycloak__realm_selector_dropdown__toggle"
> >
{realm} {realm}
</DropdownToggle> </DropdownToggle>
} }
onFocus={refresh}
dropdownItems={[...dropdownItems, addRealmComponent]} dropdownItems={[...dropdownItems, addRealmComponent]}
/> />
)} )}