-
-
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
Conversation
WalkthroughIntroduces VueElement._processMutations to centralize MutationObserver handling, replaces inline observer callbacks with a bound handler, updates observer lifecycle during attribute reflection, and adds tests verifying combined attribute/property updates on defineCustomElement components (including primitive reflection and non-primitive non-reflection). 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 definition
Note over CE: Setup — observer bound to CE._processMutations
U->>CE: set property (bar)\nsetAttribute('foo', v)
alt attribute mutation observed
OB-->>CE: mutations[]
CE->>CE: _processMutations(mutations)
CE->>CE: _setAttr('foo') → may reflect to attribute
CE->>DEF: apply prop update (foo)
else property update path
CE->>DEF: apply prop update (bar)
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
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)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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). (6)
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: |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
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