mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 19:56:18 -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
|
onRetry?: () => void
|
||||||
retrying?: boolean
|
retrying?: boolean
|
||||||
testId?: string
|
testId?: string
|
||||||
|
/** Optional override for the Retry button's data-testid (defaults to none). */
|
||||||
|
retryTestId?: string
|
||||||
className?: string
|
className?: string
|
||||||
/** Optional availability strip (stale/limited/partial) above the state body. */
|
/** Optional availability strip (stale/limited/partial) above the state body. */
|
||||||
availability?: DataAvailability
|
availability?: DataAvailability
|
||||||
@@ -72,6 +74,7 @@ export function RouteState({
|
|||||||
onRetry,
|
onRetry,
|
||||||
retrying = false,
|
retrying = false,
|
||||||
testId,
|
testId,
|
||||||
|
retryTestId,
|
||||||
className = '',
|
className = '',
|
||||||
availability,
|
availability,
|
||||||
children,
|
children,
|
||||||
@@ -113,6 +116,7 @@ export function RouteState({
|
|||||||
onClick={onRetry}
|
onClick={onRetry}
|
||||||
disabled={retrying}
|
disabled={retrying}
|
||||||
aria-busy={retrying || undefined}
|
aria-busy={retrying || undefined}
|
||||||
|
data-testid={retryTestId}
|
||||||
>
|
>
|
||||||
{retrying ? 'Retrying…' : 'Retry'}
|
{retrying ? 'Retrying…' : 'Retry'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ export function RaceHubPage({ sessionKey }: Props) {
|
|||||||
if (!contextQuery.isFetching) void contextQuery.refetch()
|
if (!contextQuery.isFetching) void contextQuery.refetch()
|
||||||
}}
|
}}
|
||||||
retrying={contextQuery.isFetching}
|
retrying={contextQuery.isFetching}
|
||||||
|
retryTestId="rh-retry"
|
||||||
>
|
>
|
||||||
<div className="rh-recover-actions">
|
<div className="rh-recover-actions">
|
||||||
<Link to="/" search={{}} className="rh-recover-btn" data-testid="rh-back-weekend">
|
<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()
|
if (!raceHubQuery.isFetching) void raceHubQuery.refetch()
|
||||||
}}
|
}}
|
||||||
retrying={raceHubQuery.isFetching}
|
retrying={raceHubQuery.isFetching}
|
||||||
|
retryTestId="rh-retry"
|
||||||
>
|
>
|
||||||
<div className="rh-recover-actions">
|
<div className="rh-recover-actions">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -384,7 +384,8 @@ describe('RaceHubPage', () => {
|
|||||||
|
|
||||||
renderRaceHub(0)
|
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)
|
expect(mockFetchRaceHub).not.toHaveBeenCalledWith(9600)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user