diff --git a/cypress/integration/events_test.spec.ts b/cypress/integration/events_test.spec.ts index e694957ab5..c9798225f6 100644 --- a/cypress/integration/events_test.spec.ts +++ b/cypress/integration/events_test.spec.ts @@ -28,7 +28,7 @@ describe("Events tests", () => { realmSettingsPage .toggleSwitch(realmSettingsPage.enableEvents) - .save(realmSettingsPage.modalConfirm); + .save(realmSettingsPage.eventsUserSave); masthead.signOut(); loginPage.logIn(); @@ -78,7 +78,7 @@ describe("Events tests", () => { realmSettingsPage .toggleSwitch(realmSettingsPage.enableAdminEvents) - .save(realmSettingsPage.modalConfirm); + .save(realmSettingsPage.eventsAdminSave); sidebarPage.goToEvents(); cy.findByTestId("admin-events-tab").click(); diff --git a/cypress/support/pages/admin_console/manage/events/UserEventsTab.ts b/cypress/support/pages/admin_console/manage/events/UserEventsTab.ts index 8c6f431356..accb00c982 100644 --- a/cypress/support/pages/admin_console/manage/events/UserEventsTab.ts +++ b/cypress/support/pages/admin_console/manage/events/UserEventsTab.ts @@ -55,7 +55,7 @@ export default class UserEventsTab { cy.get("[id^=remove_group]").click(); cy.wait("@eventsFetch"); - cy.get("table").should("be.visible").contains("td", "LOGOUT"); + cy.get("table").should("not.contain", "LOGOUT"); } shouldHaveSearchBtnEnabled() { diff --git a/src/context/auth/AdminClient.tsx b/src/context/auth/AdminClient.tsx index a2e8ad4291..4bb44c9bc9 100644 --- a/src/context/auth/AdminClient.tsx +++ b/src/context/auth/AdminClient.tsx @@ -33,10 +33,13 @@ export function useFetch( const adminClient = useAdminClient(); const onError = useErrorHandler(); - const source = axios.CancelToken.source(); - adminClient.setConfig({ requestConfig: { cancelToken: source.token } }); - useEffect(() => { + const source = axios.CancelToken.source(); + + adminClient.setConfig({ + requestConfig: { cancelToken: source.token }, + }); + adminClientCall() .then((result) => { if (!source.token.reason) { @@ -49,6 +52,10 @@ export function useFetch( } }); + adminClient.setConfig({ + requestConfig: { cancelToken: undefined }, + }); + return () => { source.cancel(); }; diff --git a/src/identity-providers/IdentityProvidersSection.tsx b/src/identity-providers/IdentityProvidersSection.tsx index e75cdf7b59..5b623134a7 100644 --- a/src/identity-providers/IdentityProvidersSection.tsx +++ b/src/identity-providers/IdentityProvidersSection.tsx @@ -15,6 +15,7 @@ import { DropdownToggle, Gallery, PageSection, + Spinner, Split, SplitItem, Text, @@ -50,9 +51,8 @@ export default function IdentityProvidersSection() { const [addProviderOpen, setAddProviderOpen] = useState(false); const [manageDisplayDialog, setManageDisplayDialog] = useState(false); - const [providers, setProviders] = useState( - [] - ); + const [providers, setProviders] = + useState(); const [selectedProvider, setSelectedProvider] = useState(); @@ -142,7 +142,7 @@ export default function IdentityProvidersSection() { alias: selectedProvider!.alias!, }); setProviders([ - ...providers.filter((p) => p.alias !== selectedProvider?.alias), + ...providers!.filter((p) => p.alias !== selectedProvider?.alias), ]); refresh(); addAlert(t("deletedSuccess"), AlertVariant.success); @@ -152,6 +152,10 @@ export default function IdentityProvidersSection() { }, }); + if (!providers) { + return ; + } + return ( <>