Skip to content

Commit e85a885

Browse files
committed
Disable refetchOnWindowFocus for test runs query
Previously, the 'Refresh logs' button was triggering a loading state on mount, since the step gets focused and the query gets triggered. We don't need to refetch on window focus, in order to rely on the refresh logs button only + the current internal polling mechanism.
1 parent 89ce82d commit e85a885

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

packages/shared/src/react/hooks/useEnterpriseConnectionTestRuns.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function useEnterpriseConnectionTestRuns(
104104
},
105105
enabled: queryEnabled,
106106
refetchIntervalInBackground: false,
107+
refetchOnWindowFocus: false,
107108
});
108109

109110
const hasRows = (query.data?.data?.length ?? 0) > 0;

packages/ui/src/components/ConfigureSSO/elements/Stepper/Stepper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

3-
import { Box, descriptors, Flex, Icon, SimpleButton, Span, Text } from '@/customizables';
4-
import { Checkmark, ChevronRight } from '@/icons';
3+
import { Box, descriptors, Flex, Icon, SimpleButton, Text, Span } from '@/customizables';
4+
import { ChevronRight, Checkmark } from '@/icons';
55

66
import type { StepperItemProps, StepperProps } from './types';
77

packages/ui/src/components/ConfigureSSO/steps/__tests__/SelectProviderStep.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ describe('SelectProviderStep', () => {
102102
expect(screen.getByText(/We.*ll guide you through the detailed setup process next\./)).toBeInTheDocument();
103103
});
104104

105-
it('renders both SAML provider radios with their labels', async () => {
105+
it('renders all SAML provider radios with their labels', async () => {
106106
resetMocks();
107107
const { wrapper } = await createFixtures();
108108
renderStep(wrapper);
109109

110110
expect(screen.getByRole('radio', { name: 'Okta Workforce' })).toBeInTheDocument();
111111
expect(screen.getByRole('radio', { name: 'Custom SAML Provider' })).toBeInTheDocument();
112+
expect(screen.getByRole('radio', { name: 'Google Workspace' })).toBeInTheDocument();
112113
});
113114

114115
it('loads each tile icon from img.clerk.com', async () => {
@@ -118,7 +119,7 @@ describe('SelectProviderStep', () => {
118119

119120
// Emotion serializes sx into stylesheets, so we check both inline + the document's collected styles
120121
const iconSpans = Array.from(container.querySelectorAll('label span[aria-hidden]'));
121-
expect(iconSpans).toHaveLength(2);
122+
expect(iconSpans).toHaveLength(3);
122123

123124
const collectedStyles = [
124125
...Array.from(document.head.querySelectorAll('style')).map(s => s.textContent ?? ''),
@@ -127,6 +128,7 @@ describe('SelectProviderStep', () => {
127128

128129
expect(collectedStyles).toMatch(/img\.clerk\.com\/static\/okta\.svg/);
129130
expect(collectedStyles).toMatch(/img\.clerk\.com\/static\/saml\.svg/);
131+
expect(collectedStyles).toMatch(/img\.clerk\.com\/static\/google\.svg/);
130132
});
131133

132134
it('disables Continue when no provider is selected', async () => {

0 commit comments

Comments
 (0)