feat(vue-router): add styles support on head#7320
feat(vue-router): add styles support on head#7320romulovalez wants to merge 1 commit intoTanStack:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR adds a ChangesStyle Tag Support in Vue Router
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/vue-router/src/Matches.tsx`:
- Line 31: The styles property is incorrectly typed as
Vue.ComponentOptions['style']; change it to represent HTML <style> element
attributes with optional key and children for content (matching how
headContentUtils.tsx destructures match.styles and React uses
React.JSX.IntrinsicElements['style']). Update the declaration of styles in
Matches.tsx to an array of the HTML/style attribute type (e.g.
JSX.IntrinsicElements['style'] or HTML attributes for a style element) with & {
key?: string; children?: string } (and allow undefined entries) so deduplication
keying and style content typing are correct.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6e8a9361-2175-4ed5-95ce-4b368f44fafe
📒 Files selected for processing (2)
packages/vue-router/src/Matches.tsxpackages/vue-router/src/headContentUtils.tsx
|
I will fix nonce support in another follow-up PR |
Summary
Closes #7318.
stylesfield to the VueRouteMatchExtensionsmodule augmentation inpackages/vue-router/src/Matches.tsx, alongsidemeta,links,scripts, andheadScripts— bringing Vue to parity with the React and Solid counterparts.packages/vue-router/src/headContentUtils.tsxsohead().stylesdeclared on routes is actually rendered (mirroring the existingheadScriptspattern, then included in the finaluniqByoutput).Test plan
pnpm --filter @tanstack/vue-router test:unit(45 files, 783 tests, 0 type errors). The existingroute.test.tsxstylesandstyles w/loadertests now exercise the typed field end-to-end.Summary by CodeRabbit