Skip to content

perf: only load vue-data-ui css in components that use it - #1918

Merged
danielroe merged 2 commits into
mainfrom
fix/vue-data-ui-css
Mar 4, 2026
Merged

perf: only load vue-data-ui css in components that use it#1918
danielroe merged 2 commits into
mainfrom
fix/vue-data-ui-css

Conversation

@danielroe

@danielroedanielroe commented Mar 4, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

🧭 Context

📚 Description

this is an experiment to decrease blocking time of initial load (from css size) by only loading vue-data-ui css when we need it

it seems to drop ~7kb from the initial load:

Co-authored-by: Anthony Fu <github@antfu.me>
@danielroedanielroe changed the title perf: only load vue-data-ui css in components that use itperf: only load vue-data-ui css in components that use itMar 4, 2026
@vercel

vercelBot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentMar 4, 2026 0:03am
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewMar 4, 2026 0:03am
npmx-lunariaIgnoredIgnoredMar 4, 2026 0:03am

Request Review

@codecov

codecovBot commented Mar 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
app/components/Package/VersionDistribution.vue0.00%1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e729664-4e4c-4bc6-ade9-129fcdb9dfa5

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5a6cb and 186d92a.

📒 Files selected for processing (4)
  • app/components/Package/TrendsChart.vue
  • app/components/Package/VersionDistribution.vue
  • app/components/Package/WeeklyDownloadStats.vue
  • nuxt.config.ts

📝 Walkthrough

Walkthrough

This PR refactors the CSS loading strategy for the vue-data-ui library. Instead of loading styles globally via the Nuxt configuration, the styles are now dynamically imported within individual Vue components that utilise the library (TrendsChart, VersionDistribution, and WeeklyDownloadStats). The global CSS reference is removed from nuxt.config.ts, transitioning from centralised to component-level stylesheet loading.

Possibly related PRs

Suggested labels

front

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check nameStatusExplanation
Description check✅ PassedThe pull request description clearly explains the purpose: reducing CSS blocking time by loading vue-data-ui CSS only in components that need it, with specific performance improvements mentioned.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/vue-data-ui-css

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@danielroe
danielroe added this pull request to the merge queueMar 4, 2026
@alexdln

Copy link
Copy Markdown
Member

I even got 17kb diff locally - it went into a separate bundle and only loaded where there are charts 🔥

Merged via the queue into main with commit f3403ebMar 4, 2026
24 checks passed
@danielroe
danielroe deleted the fix/vue-data-ui-css branch March 4, 2026 12:53
@github-actionsgithub-actionsBot mentioned this pull request Mar 4, 2026
Sign up for freeto 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.

2 participants

@danielroe@alexdln