mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 11:54:59 -04:00
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:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user