nuxt / nuxt/icon

Remote server bundle duplicates concurrent collection downloads

Open
#534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
96
Avg merge
8h 12m
Merged PRs (30d)
2

Description

When several server API requests ask for different icons from the same cold remote collection, each request starts its own full collection download. The cache is assigned only after fetch(...).json() resolves, leaving concurrent callers uncached.

In a production Node server with 20 overlapping API requests and a 49,940-byte synthetic collection, the current package makes 20 origin requests and transfers 998,800 uncompressed body bytes. Sharing the pending fetch reduces this to one request and 49,940 bytes.

Minimal reproduction: https://github.com/onmax/repros/tree/repro/nuxt-icon-perf-remote-collection-dedup/nuxt-icon-perf-remote-collection-dedup

git clone --depth 1 --branch repro/nuxt-icon-perf-remote-collection-dedup https://github.com/onmax/repros.git nuxt-icon-repro
cd nuxt-icon-repro/nuxt-icon-perf-remote-collection-dedup
npx --yes --package=node@24.19.0 --package=pnpm@11.15.1 --call 'pnpm install --frozen-lockfile && pnpm verify'
cd ../nuxt-icon-perf-remote-collection-dedup-fix
npx --yes --package=node@24.19.0 --package=pnpm@11.15.1 --call 'pnpm install --frozen-lockfile && pnpm verify'

The fixed fixture contains a pnpm patch and expects exactly one cold download. Both fixtures also verify warm caching, retry after a fetch/JSON failure, and retry after a falsey JSON result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the linked repro's original and fixed fixtures with the provided Node and pnpm commands, then compare their verification results. The fix is done when concurrent requests produce exactly one cold collection download while warm caching works and fetch/JSON, including falsey JSON, failures can be retried.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.