-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
fix(custom-element): set prop runs pending mutations before disconnect #13897
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughIntroduces a dedicated mutation-processing method for VueElement and refactors MutationObserver usage to route through it. Adjusts observer lifecycle during attribute reflection. Adds tests validating combined attribute/property updates on defineCustomElement components, ensuring primitives reflect to attributes while non-primitives do not. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User Code
participant CE as VueElement (Custom Element)
participant OB as MutationObserver
participant DEF as Component Def
Note over CE: Initialization
U->>CE: set property (bar)\nsetAttribute('foo', v)
alt Property update
CE->>DEF: update prop (bar)
end
alt Attribute update
CE->>OB: attribute changes observed
OB-->>CE: mutations[]
CE->>CE: _processMutations(mutations)\n→ _setAttr('foo')
CE->>DEF: update prop (foo)
end
Note over CE: During reflection in _setAttr
CE->>OB: ob.takeRecords()
CE->>CE: _processMutations(pending)
CE->>OB: disconnect()
CE->>OB: observe(attributes: true)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)packages/runtime-dom/__tests__/customElement.spec.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (4)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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. Comment |
Size ReportBundles
Usages
|
@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: |
close #13315
Calling
MutationObserver.disconnect()
may cause problems if there are still pending mutations that have not been asynchronously processed yet; before disconnecting flush/process the pending mutations queue to ensure all attribute updates are accounted for.Summary by CodeRabbit
Bug Fixes
Refactor
Tests