Skip to content

fix(oxc): keep overview working when latest versions are unreachable - #627

Open
zerone0x wants to merge 1 commit into
vitejs:mainfrom
zerone0x:fix/oxc-overview-offline
Open

zerone0x wants to merge 1 commit into
vitejs:mainfrom
zerone0x:fix/oxc-overview-offline

Conversation

@zerone0x

@zerone0x zerone0x commented Nov 3, 2026

Copy link
Copy Markdown

Description

The devtools-oxc:overview RPC fetched the latest Oxlint/Oxfmt versions from https://npm.antfu.dev/oxlint+oxfmt with no error handling. When Node can't reach that host (VPN split tunneling, restricted networks), the whole overview rejects and the Oxc panel shows Error: fetch failed, even though local Oxlint/Oxfmt info is available.

This PR makes the latest-version lookup best-effort:

  • New fetchLatestVersions() helper: 5s timeout (AbortSignal.timeout), response.ok check, and a try/catch. It also validates the payload shape. On any failure it returns undefined versions.
  • Package.latest is now boolean | undefined. undefined means the latest version is unknown, and it is never treated as outdated.
  • In the overview page, the "Latest" / "Update Available" badge is hidden when latest is unknown, so there's no false "Update Available". Version, links and tool views still render as before.

Linked Issues

Fixes #626

Additional context

Added packages/oxc/src/node/__tests__/overview.test.ts, which covers the success path, a rejected fetch, a non-OK response, and the overview still reporting local versions when the lookup fails. These tests fail on main and pass with this change.

Ran locally: pnpm lint, pnpm typecheck, pnpm test (55 files / 407 tests passed), and pnpm -C packages/oxc build.

The overview RPC fetched the latest Oxlint/Oxfmt versions from
npm.antfu.dev without error handling, so any network failure made the
whole overview reject with "fetch failed". The lookup is now
best-effort (timeout, response.ok check, try/catch); when it fails,
`latest` is left unknown and the panel hides the version badge.

Fixes vitejs#626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

devtools-oxc: overview fails with "Error: fetch failed" when npm.antfu.dev is unreachable

1 participant