Skip to content

perf(components): import Reka UI primitives by name instead of from reka-ui/namespaced - #7176

Merged
benjamincanac merged 1 commit into
v4from
perf/reka-named-imports
Oct 9, 2026
Merged

benjamincanac merged 1 commit into
v4from
perf/reka-named-imports

Conversation

@benjamincanac

Copy link
Copy Markdown
Member

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Noticed this while looking at the docs homepage, where the header's popover and dropdown menu load a 210 kB chunk holding the calendar, the date and time fields and the context menu.

Seven components import their primitives from reka-ui/namespaced. That entry is a single module, so the bundler puts every namespace used anywhere in the app into one chunk, and a page that only renders a Popover loads all of them. This PR imports the primitives by name from reka-ui and rebuilds the small { Root, Content, ... } maps locally, so the templates don't change.

Measured on the nuxt bundle fixture with two pages, one rendering a Popover and a DropdownMenu, the other a Calendar, InputDate, InputTime, InputMenu and ContextMenu. This is the JS the first page loads:

Before After
JS 760 kB 510 kB
JS (gzip) 229 kB 172 kB

The total output stays the same, so pnpm run size won't show it.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
ui Ready Ready Preview Oct 9, 2026 2:41pm UTC
ui-repl Ready Ready Preview Oct 9, 2026 2:41pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Client output of the apps in test/bundle, compared to the base branch.

Fixture JS (gzip) CSS (gzip)
nuxt 117.1 kB 27.4 kB
nuxt-detection 117.1 kB 10.5 kB
nuxt-full 839.0 kB (-0.6 kB, -0.1%) 27.6 kB
vue 95.6 kB 25.6 kB
vue-detection 95.6 kB 8.8 kB
Raw sizes
Fixture JS CSS
nuxt 334.5 kB 203.6 kB
nuxt-detection 334.5 kB 61.4 kB
nuxt-full 2647.8 kB (-2.4 kB, -0.1%) 203.8 kB
vue 282.7 kB 201.6 kB
vue-detection 282.7 kB 57.9 kB

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack β†’

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7a6a52d-b5bb-4e8f-90de-ec43c8aa1e0e

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 8c92e5f and 508a84f.


πŸ“’ Files selected for processing (7)
  • src/runtime/components/Calendar.vue
  • src/runtime/components/ContextMenuContent.vue
  • src/runtime/components/DropdownMenuContent.vue
  • src/runtime/components/InputDate.vue
  • src/runtime/components/InputMenu.vue
  • src/runtime/components/InputTime.vue
  • src/runtime/components/Popover.vue

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



πŸ“ Walkthrough

Walkthrough

Seven runtime components now import Reka UI primitives directly instead of importing namespaced component groups. Each component assembles local objects that preserve the primitive members used by its existing templates or selection logic.

Priority: βž– Normal

Estimated code review effort: 2 (Simple) | ~10 minutes


Merge Risk: βšͺ Minimal Β· up to 508a8

The components retain their existing picker, menu, and popover component mappings while switching to direct imports. No actionable merge risk remains; proceed with normal checks.

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description check Passed The description clearly explains the change from namespaced imports to direct Reka UI primitive imports and states the bundle-size benefit.
Title check Passed The title clearly and concisely summarizes the main change: importing Reka UI primitives by name instead of from reka-ui/namespaced.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

βœ… 31 untouched benchmarks


Comparing perf/reka-named-imports (508a84f) with v4 (8c92e5f)

Open in CodSpeed

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@7176

commit: 508a84f

@benjamincanac
benjamincanac merged commit 896d609 into v4 Oct 9, 2026
35 checks passed
@benjamincanac
benjamincanac deleted the perf/reka-named-imports branch October 9, 2026 14:50

This branch was successfully deployed

2 active deployments
Preview – ui β€” 508a84f7 Deployed Oct 9, 2026 by vercel[bot]
Preview – ui-repl β€” 508a84f7 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant