-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
fix(custom-element): ensure correct order of nested component styles #13030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(custom-element): ensure correct order of nested component styles #13030
Conversation
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
LGTM~ |
""" WalkthroughThe changes update the style injection mechanism for Vue custom elements to ensure that child component styles are injected before parent styles in the shadow DOM. This is achieved by tracking and reusing style elements per component using a Changes
Sequence Diagram(s)sequenceDiagram
participant ParentComponent
participant WrapperComponent
participant ChildComponent
participant VueElement
participant ShadowRoot
ChildComponent->>VueElement: Mount with styles (green)
VueElement->>ShadowRoot: Prepend child styles (green)
WrapperComponent->>VueElement: Mount with styles (blue)
VueElement->>ShadowRoot: Prepend wrapper styles (blue)
ParentComponent->>VueElement: Mount with styles (red)
VueElement->>ShadowRoot: Prepend parent styles (red)
Assessment against linked issues
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
const existingStyles = this._styleChildren.get(owner) | ||
if (existingStyles) { | ||
// move existing styles to the top | ||
this.shadowRoot!.prepend(...existingStyles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here is incorrect; the rendered style should not be moved to the very top but rather before the current parent component's style.
see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
插入顺序确实有点问题。我看到你已经提了新pr,先关闭这个pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I'm not entirely sure if my implementation is correct, I didn't make changes directly to your PR but instead created a new one. If you're interested, you could help review it.
fix #13029
Summary by CodeRabbit
Bug Fixes
Tests