Skip to content

fix: show fallback for oversized package files - #3120

Merged
ghostdevv merged 1 commit into
npmx-dev:mainfrom
anilloutombam:fix/code-browser-large-file
Aug 3, 2026
Merged

fix: show fallback for oversized package files#3120
ghostdevv merged 1 commit into
npmx-dev:mainfrom
anilloutombam:fix/code-browser-large-file

Conversation

@anilloutombam

@anilloutombam anilloutombam commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Fixes #2732

🧭 Context

The package code browser remained in a loading state when the selected file exceeded the supported size limit. The page already had a fallback for oversized files, but it was never rendered because the skipped content request remained in the idle state and was still treated as loading.

The issue can be reproduced on the current production site:

https://npmx.dev/package-code/@types/vscode/v/1.118.0/index.d.ts

The updated behaviour can be verified on the PR preview:

https://npmx-h3s403v0g-npmx.vercel.app/package-code/@types/vscode/v/1.118.0/index.d.ts

📚 Description

I updated the loading-state logic so an oversized file no longer leaves the page waiting for a request that will not run. The existing large-file warning and “Open raw file” action are now displayed as intended.

I also added a regression test that covers the oversized-file path, verifies that the fallback is rendered, and confirms that the application does not request the file content.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview Aug 3, 2026 8:11am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Aug 3, 2026 8:11am
npmx-lunaria Ignored Ignored Aug 3, 2026 8:11am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Oversized package files now skip the loading state and display the raw-file fallback immediately.
    • Prevented unnecessary file-content requests for files exceeding the supported size limit.
  • Tests

    • Added coverage confirming the fallback display, loading behaviour, request handling, and generated CDN URL for oversized files.

Walkthrough

Changes

Large file fallback

Layer / File(s) Summary
Oversized file fallback and validation
app/pages/package-code/.../[...filePath].vue, test/nuxt/pages/PackageCodePage.spec.ts
The page stops showing the loading state when a file exceeds MAX_FILE_SIZE. The integration test verifies the “File too large” fallback, avoids file-content fetching, and checks the jsDelivr raw-file URL.

Suggested reviewers: serhalp

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #2732 by rendering the oversized-file fallback and avoiding an unnecessary content request.
Out of Scope Changes check ✅ Passed The changes are limited to the oversized-file loading fix and its regression test.
Title check ✅ Passed The title clearly describes the main change: showing the fallback for oversized package files.
Description check ✅ Passed The description explains the oversized-file loading issue, the fix, and the regression test.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@ghostdevv ghostdevv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty! The only issue I see currently is that it doesn't seem to work when navigating to it - e.g. if I go from README.md to index.d.ts it will show me this

Image

And then when I refresh I correctly get

Image

We can fix this in a follow up since it also happens on production

@ghostdevv
ghostdevv added this pull request to the merge queue Aug 3, 2026
Merged via the queue into npmx-dev:main with commit 82822d1 Aug 3, 2026
26 checks passed
ayo-run pushed a commit to ayo-run/npmx.dev that referenced this pull request Aug 5, 2026
@anilloutombam
anilloutombam deleted the fix/code-browser-large-file branch August 6, 2026 04:36
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.

Code browser never loads UI for large files, swallows errors

2 participants