Repository navigation
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
devtools-oxc:overviewRPC fetched the latest Oxlint/Oxfmt versions fromhttps://npm.antfu.dev/oxlint+oxfmtwith no error handling. When Node can't reach that host (VPN split tunneling, restricted networks), the whole overview rejects and the Oxc panel showsError: fetch failed, even though local Oxlint/Oxfmt info is available.This PR makes the latest-version lookup best-effort:
fetchLatestVersions()helper: 5s timeout (AbortSignal.timeout),response.okcheck, and atry/catch. It also validates the payload shape. On any failure it returnsundefinedversions.Package.latestis nowboolean | undefined.undefinedmeans the latest version is unknown, and it is never treated as outdated.latestis 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 onmainand pass with this change.Ran locally:
pnpm lint,pnpm typecheck,pnpm test(55 files / 407 tests passed), andpnpm -C packages/oxc build.