fix: show 404 page instead of blank on first visit to non-existent package#2733
fix: show 404 page instead of blank on first visit to non-existent package#27332u841r wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe package page component is updated to conditionally await version resolution only during server-side rendering. This allows missing packages to be detected and thrown synchronously on the server, whilst the client avoids awaiting to prevent Suspense-driven blank rendering. The loading skeleton visibility is extended to also show when resolved status is pending. ChangesPackage page version resolution and skeleton loading
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
gameroman
left a comment
There was a problem hiding this comment.
This seems to work but looks like a workaround. Is there potentially a better solution?
|
Making A route middleware using Skipping the Not 100% confident this is the cleanest fix. Would defer to your judgment if you see something better. |
When you visit a package URL that doesn't exist for the first time, Vercel serves an ISR fallback HTML while SSR runs in the background. On that first load the page was completely blank until you refreshed.
The cause was an
awaitonuseResolvedVersionin the component setup. On the client that suspends the component through Vue's Suspense, and since there is no fallback defined, nothing renders while the fetch is in flight.The fix skips the await on the client. The server still awaits so the 404 can be thrown synchronously. On the client the existing watch already handles the error case and calls
showError. Also addedresolvedStatus === 'pending'to the skeleton condition so a loading state shows while the version fetch is running.Fixes #1602