发布

  • [OPIK-5479] [FE] fix: clear cached pair code on runner connection (#6035)

    frostbyte_neo 发布于 2026-04-01 15:18:51 +00:00

    • [OPIK-5479] [FE] fix: clear cached pair code on runner connection

    When a runner connects, the backend immediately consumes the pairing
    code (Redis getAndDelete). However the frontend kept the stale code
    in React Query cache. If the runner later disconnected, the empty
    state re-displayed the expired code, causing users to attempt
    reconnection with a code that would always fail.

    Fix: use queryClient.removeQueries() to evict the pair code cache
    as soon as isConnected becomes true. On subsequent disconnection
    React Query sees no cached data and fetches a fresh code on demand.

    • [OPIK-5479] [FE] test: add unit tests for pair code cache invalidation

    Tests verify that:

    • Empty state shows pair code when disconnected
    • Connected state renders when runner is connected
    • Pair code cache is cleared (removeQueries) on connection
    • Pair code cache is NOT cleared when disconnected
    • [OPIK-5479] [FE] fix: lint errors in test file (display names)

    • [OPIK-5479] [FE] fix: typecheck error — use vi.spyOn return type

    下载附件