Repository navigation
chore(usercontent): drop the unused theme stylesheet route and helper - #7384
Conversation
`injectStylesheetLink` and the `/_superset/theme.css` route it was written for have no callers: #7312 landed the theme by inlining it with `injectStyleTag` instead, and nothing has linked the stylesheet since. The route served bytes no page ever asked for. Its tests were the only real coverage of `injectIntoHead` — head with attributes, a `>` inside a quoted attribute, a head inside a comment, a script or a style, `<header>` false positives — which `injectStyleTag` still depends on to put the theme on every published page. Retargeted rather than deleted, and folded the two thinner `injectStyleTag` cases in. Claude-Session: https://claude.ai/code/session_01Ho5jMfrUs1e65svM8M2Hc6
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe change removes the theme stylesheet endpoint, helper, constant, and re-exports. Inline style injection remains available, with expanded tests for head detection and insertion behavior. ChangesUsercontent stylesheet removal
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The unused stylesheet endpoint and helper are removed while inline page theming remains supported and tested. No current merge-blocking risk is identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Biome (2.5.10)packages/shared/src/usercontent/index.tsBiome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins. packages/shared/src/usercontent/inject.test.tsBiome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins. 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 |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Why
injectStylesheetLinkand the/_superset/theme.cssroute it was written for have no callers. #7312 landed page theming by inlining the CSS withinjectStyleTaginstead, and nothing has linked the stylesheet since. The route served bytes no page ever asked for, and the helper carried ~20 tests for a code path that never ran.Checked before removing: nothing in
apps/orpackages/references either symbol, and the path isn't documented anywhere for page authors.The tests are retargeted, not deleted
injectStylesheetLink's suite was the only real coverage ofinjectIntoHead— head with attributes, a>inside a quoted attribute, a head inside a comment, a script or a style,<header>false positives, doctype fallbacks, a 2000-script-block document.injectStyleTagshares that helper and uses it to put the theme on every published page, so deleting the suite would have dropped regression cover for code that still runs — including the case6859ee629was written to fix.They now exercise
injectStyleTag, and the two thinnerinjectStyleTagcases are folded in. One assertion needed a real change: "stays ahead of the page's own styles" compared againstindexOf("<style>"), which now matches the injected tag, so it targets the page's own CSS instead.Verification
bun test src/usercontent/inject.test.ts— 18 pass, 0 failtypecheckclean forapps/usercontent,lintclean at roothttps://claude.ai/code/session_01Ho5jMfrUs1e65svM8M2Hc6
Summary by cubic
Removes the unused theme stylesheet route and
injectStylesheetLinkhelper; no page ever requested the CSS since theming was inlined viainjectStyleTag, so the route and helper served no purpose. The tests previously coveringinjectStylesheetLinknow exerciseinjectStyleTag's sharedinjectIntoHeadlogic, so regression coverage is preserved without any behavior change.Written for commit 6d83f44. Summary will update on new commits.
Summary by CodeRabbit