Skip to content

fix: treat any Iconify API host as the default provider - #574

Open
lafllamme wants to merge 1 commit into
nuxt:mainfrom
lafllamme:fix/iconify-default-provider
Open

lafllamme wants to merge 1 commit into
nuxt:mainfrom
lafllamme:fix/iconify-default-provider

Conversation

@lafllamme

Copy link
Copy Markdown

🔗 Linked issue

Fixes #571

📚 Description

@iconify/vue@5.0.5 changed its default provider from

['https://api.iconify.design']

to

['https://api.iconify.design', 'https://api2.iconify.design']

The check added in #565 compares the current provider against that exact host list. With 5.0.5 the comparison fails, so Nuxt assumes the app configured a provider itself and never registers its local API. The client then loads icons from the public Iconify API even though provider: 'server' is the default.

This detects Iconify's public hosts by pattern instead of by a fixed list:

const DEFAULT_RESOURCE = /^https:\/\/api\d*\.iconify\.design$/

I considered adding api2.iconify.design to the existing array, but the same bug would come back as soon as Iconify ships api3. The host pattern keeps working for future hosts, and it can only match api, api2, api42, ... on iconify.design.

Anything that doesn't match is treated as a provider set by the app and is left alone. The anchoring matters here: lookalike domains must never be mistaken for Iconify's API.

Provider resources Treated as default Result
https://api.iconify.design yes replaced with /api/_nuxt_icon
https://api2.iconify.design yes replaced
https://api42.iconify.design yes replaced
https://api.iconify.design.evil.com no kept
https://api.iconify.design@evil.com no kept
https://evil.com/https://api.iconify.design no kept
http://api.iconify.design no kept
https://api-2.iconify.design no kept
https://apiiconify.design no kept
Iconify host + https://icons.example.com no kept (all resources must match)

🧪 Tests

  • Added a regression test using the 5.0.5 default resources.
  • Added it.each cases for the hosts above, so the boundary of the check is covered.
  • The test helper now reads the default provider from the installed @iconify/vue instead of hard-coding it. That hard-coded value is what hid the bug.
  • pnpm test passes (133 unit tests, playground e2e, both fixture builds), along with lint, build and typecheck.
  • Checked a production playground build in a browser: before the fix the client requested https://api.iconify.design/lucide.json?icons=rocket, after it requests /api/_nuxt_icon/lucide.json?icons=rocket.

@iconify/vue 5.0.5 ships `https://api2.iconify.design` next to the old
`https://api.iconify.design` in its default provider. The check added in nuxt#565
only knew the single old host, so it assumed the app had set a provider itself
and never switched to Nuxt's local API.

Match the host pattern instead of a fixed list. That also covers a future
`api3` without another release here, while lookalike domains stay untouched.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The provider-default check now accepts any non-empty resource list in which every resource matches the HTTPS Iconify host pattern, including numbered api subdomains. The tests capture and restore the installed Iconify default resources. They also check that supported public hosts are replaced and that lookalike hosts, HTTP resources, and lists containing custom resources are preserved.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 1e12b

Public Iconify hosts are redirected locally while custom hosts remain unchanged. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title states the main change: the default-provider check now recognises any Iconify API host, not only the exact previous host list. It matches the raw summary, which describes a host-pattern matc…
Description check Passed The description links issue #571 and explains the regression. It describes the host-pattern change, the lookalike-domain boundary cases, the test changes, and the verification steps. All of this match…
Linked Issues check Passed Issue #571 requires the default server provider to replace Iconify public API resources with /api/_nuxt_icon, while preserving custom and lookalike resources. src/runtime/iconify-config.ts now mat…
Out of Scope Changes check Passed The changes are limited to the provider detection in src/runtime/iconify-config.ts and focused regression coverage in test/iconify-config.test.ts. The test helper change supports verification agai…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title states the main change: the default-provider check now recognises any Iconify API host, not only the exact previous host list. It matches the raw summary, which describes a host-pattern match in applyIconifyConfig and the new tests for numbered api hosts.

Full details: Description check

Explanation

The description links issue #571 and explains the regression. It describes the host-pattern change, the lookalike-domain boundary cases, the test changes, and the verification steps. All of this matches the changeset in iconify-config.ts and the test file.

Full details: Linked Issues check

Explanation

Issue #571 requires the default server provider to replace Iconify public API resources with /api/_nuxt_icon, while preserving custom and lookalike resources. src/runtime/iconify-config.ts now matches only anchored https://api\d*\.iconify\.design hosts and requires every resource to match before replacement. The tests cover the 5.0.5 two-host default, numbered hosts, lookalike hosts, non-HTTPS hosts, and mixed custom resources.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the provider detection in src/runtime/iconify-config.ts and focused regression coverage in test/iconify-config.test.ts. The test helper change supports verification against the installed @iconify/vue default. No unrelated implementation or test changes are shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d595647-cc74-4da6-8b70-065bd06fe070
Commits

Reviewing files that changed from the base of the PR and between 60f8d90 and 1e12bf1.

Files selected for processing: 2

  • src/runtime/iconify-config.ts
  • test/iconify-config.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/icon@574

commit: 1e12bf1

This branch has not been deployed

No deployments
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.

Client ignores the server provider with @iconify/vue 5.0.5 (default resources now include api2.iconify.design)

1 participant