fix(query-devtools/utils): scope the 'setupStyleSheet' dedup check to the target so a 'shadowDOMTarget' still receives its own '#_goober' style tag when 'document.head' already has one#10815
Conversation
… the target so a 'shadowDOMTarget' still receives its own '#_goober' style tag when 'document.head' already has one
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughsetupStyleSheet now deduplicates ChangessetupStyleSheet Target-Scoped Deduplication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 0e6a46e
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview2 package(s) bumped directly, 23 bumped as dependents. 🟩 Patch bumps
|
size-limit report 📦
|
🎯 Changes
setupStyleSheetaccepts an optionaltarget: ShadowRootso the goober#_gooberstyle can live inside an Embedded devtools'ShadowRootinstead of the hostdocument.head. The dedup check useddocument.querySelector('#_goober') || target?.querySelector('#_goober'), so oncedocument.headhad a#_goober(e.g. a floating devtools mounted earlier in the same page), a subsequent Embedded devtools mount with aShadowRoottarget hit the short-circuit and skipped its own install — leaving theShadowRootwithout goober's stylesheet and the Embedded devtools UI unstyled.Scope the dedup check to the actual install root: when a
targetis provided, only look inside that target; otherwise fall back todocument.head. The install path collapses to a singleroot.appendChildsince the only choice is now betweentargetanddocument.head.The existing
setupStyleSheettests still cover the document-only and target-only dedup paths. A newshould install the style tag into the "ShadowRoot" target even when "document.head" already has onecase callssetupStyleSheettwice — once fordocument.head, once for theShadowRoot— and asserts theShadowRootends up with its own#_goobercarrying the secondnonce, so the regression would fail loudly if the cross-target dedup is reintroduced.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit