fix(#76): preserve Race Hub retry testid after RouteState migrate

Keep rh-retry discoverable for existing Race Hub recovery tests and accept
AbortSignal on bare-route default analysis fetch assertions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-12 19:54:16 -04:00
parent 5ea8a4a9c4
commit ad0eb26e05
3 changed files with 8 additions and 1 deletions

View File

@@ -39,6 +39,8 @@ interface RouteStateProps {
onRetry?: () => void
retrying?: boolean
testId?: string
/** Optional override for the Retry button's data-testid (defaults to none). */
retryTestId?: string
className?: string
/** Optional availability strip (stale/limited/partial) above the state body. */
availability?: DataAvailability
@@ -72,6 +74,7 @@ export function RouteState({
onRetry,
retrying = false,
testId,
retryTestId,
className = '',
availability,
children,
@@ -113,6 +116,7 @@ export function RouteState({
onClick={onRetry}
disabled={retrying}
aria-busy={retrying || undefined}
data-testid={retryTestId}
>
{retrying ? 'Retrying…' : 'Retry'}
</button>

View File

@@ -122,6 +122,7 @@ export function RaceHubPage({ sessionKey }: Props) {
if (!contextQuery.isFetching) void contextQuery.refetch()
}}
retrying={contextQuery.isFetching}
retryTestId="rh-retry"
>
<div className="rh-recover-actions">
<Link to="/" search={{}} className="rh-recover-btn" data-testid="rh-back-weekend">
@@ -212,6 +213,7 @@ export function RaceHubPage({ sessionKey }: Props) {
if (!raceHubQuery.isFetching) void raceHubQuery.refetch()
}}
retrying={raceHubQuery.isFetching}
retryTestId="rh-retry"
>
<div className="rh-recover-actions">
<Link

View File

@@ -384,7 +384,8 @@ describe('RaceHubPage', () => {
renderRaceHub(0)
await waitFor(() => expect(mockFetchRaceHub).toHaveBeenCalledWith(9471))
await waitFor(() => expect(mockFetchRaceHub).toHaveBeenCalledWith(9471, expect.any(AbortSignal)))
expect(mockFetchRaceHub).not.toHaveBeenCalledWith(9600, expect.anything())
expect(mockFetchRaceHub).not.toHaveBeenCalledWith(9600)
})