Skip to content

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

Merged
danielroe merged 2 commits intomainfrom
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 intomainfrom
fix/vue-data-ui-css

Conversation

@danielroe
Copy link
Member

@danielroe danielroe commented Mar 4, 2026

🔗 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>
@danielroe danielroe changed the title perf: only load vue-data-ui css in components that use it perf: only load vue-data-ui css in components that use it Mar 4, 2026
@vercel
Copy link

vercel bot commented Mar 4, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 4, 2026 0:03am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 4, 2026 0:03am
npmx-lunaria Ignored Ignored Mar 4, 2026 0:03am

Request Review

@codecov
Copy link

codecov bot commented Mar 4, 2026

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 lines Patch % Lines
app/components/Package/VersionDistribution.vue 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@danielroe danielroe marked this pull request as ready for review March 4, 2026 12:30
@danielroe danielroe requested a review from alexdln March 4, 2026 12:30
@danielroe danielroe enabled auto-merge March 4, 2026 12:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

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 name Status Explanation
Description check ✅ Passed The 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 queue Mar 4, 2026
@alexdln
Copy link
Member

alexdln commented Mar 4, 2026

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 f3403eb Mar 4, 2026
24 checks passed
@danielroe danielroe deleted the fix/vue-data-ui-css branch March 4, 2026 12:53
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.

2 participants