fix(database): ship the page CSS as the scoped console:style asset - #605
Conversation
The `#/ext/database` page carried its own 316 lines of CSS in `page-styles.ts` and rendered them as a `<style>` element inside the page component. That is the one place the database worker's injectable UI diverged from the protocol every other UI-shipping worker follows: page rules belong in the `console:style` asset, scoped under the wrapper attribute the console mounts around each injected render. Two things follow from the divergence. The rules were selector-scoped to `.db-page` rather than `[data-iii-ui="database"]`, so they were unlayered CSS competing with the console's layered document instead of being fenced to this worker's subtree. And the console's `lint_style` check plus the worker's own `embedded_styles_are_scoped` test both only see the registered asset, so neither covered them. Move every rule into `ui/styles.css` with the scope attribute on each selector, matching state, eval, and iii-directory. The `@keyframes` name keeps its `db-` prefix (keyframe names are global) and the `@media` block scopes its inner rules. `dist/styles.css` grows from 3.3kb to 18.8kb and `dist/page.js` drops from 614.6kb to 602.2kb, both far inside the 8 MiB per-asset cap. No visual change: the same rules apply to the same elements, now through the stylesheet the console link-swaps rather than a `<style>` tag mounted with the page.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
skill-check — worker0 verified, 49 skipped (no docs/).
Four for four. Nicely done. |
The
#/ext/databasepage shipped in #598 kept its 316 lines of CSS inui/src/page/page-styles.tsand rendered them as a<style>element inside the page component. That is the one place this worker's injectable UI diverges fromdocs/sops/injectable-console-ui.mdand from every other UI-shipping worker: page rules belong in theconsole:styleasset, scoped under thedata-iii-uiwrapper the console mounts around each injected render.Two consequences:
.db-pageinstead of[data-iii-ui="database"], so they were unlayered CSS competing with the console's layered document rather than fenced to this worker's subtree.lint_stylepass and the worker'sembedded_styles_are_scopedtest both only inspect the registered asset, so neither covered them.This moves every rule into
ui/styles.csswith the scope attribute on each selector, the same flat formstate,eval, andiii-directoryuse. The@keyframesname keeps itsdb-prefix (keyframe names are global) and the@mediablock scopes its inner rules.src/ui.rsmodule docs now saypage.jscarries the page as well as the function-trigger renderer.No visual change: the same rules apply to the same elements, now via the stylesheet the console link-swaps instead of a
<style>tag mounted with the page.Asset sizes stay well inside the 8 MiB per-asset cap:
dist/styles.css3.3kb to 18.8kb,dist/page.js614.6kb to 602.2kb.Verification
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-features(226 unit tests, including the threeui::tests)pnpm buildindatabase/ui(tsc + esbuild)lint_stylelogic over the builtdist/styles.css: no@font-face, zero unscoped top-level selectors