Skip to content

[6.x] Speed up the control panel on large entries - #15679

Merged
jasonvarga merged 3 commits into
statamic:6.xfrom
o1y:cp-perf-small-fixes
Oct 20, 2026
Merged

jasonvarga merged 3 commits into
statamic:6.xfrom
o1y:cp-perf-small-fixes

Conversation

@o1y

@o1y o1y commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

On large entries the CP is really slow for us. Most of the time went into Chrome recalculating styles. Here are two small changes that helped:

  • Rewrote a few :has() selectors that made Chrome restyle large parts of the page on almost every DOM change.
  • Tabs.vue no longer deep-watches the tabs, which walked the whole blueprint

Page load went from ~11.5s to ~1.3s and opening Live Preview from ~10.5s to ~1.5s for us.

Please treat this as a suggestion rather than a fully tested implementation. I only checked it on our setup in Chrome. There are a still a few other rules with the same pattern (e.g. in base.css and Header.vue) that might be worth a look too. In general I would avoid has on body or any other big container.


*/
@utility bg-architectural-lines {
&:not(:has(.page-tree-branch)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's fine to drop, now that #15681 is in. The navigation page wasn't removing the class when you left, so after visiting an empty nav the lines would show up on other pages. The :has(.page-tree-branch) guard was quietly hiding that behind the Pages tree. With #15681 the class doesn't leak any more, so the guard isn't needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Rebased onto 6.x so #15681 is included :)

@o1y
o1y force-pushed the cp-perf-small-fixes branch from 4de0216 to 6e87d91 Compare October 19, 2026 18:56
Comment on lines 134 to 144
/* GRID FIELDTYPE / Assets fieldtype in a grid fieldtype / Row Compression
=================================================== */
/* When a grid field has at least 2 columns (so 3 including the menu control) change the presentation and compress the padding so it fits in with the other grid cells */
/* Table UI Mode */
.grid-table tr:has(> :nth-child(3)) .grid-cell.assets-fieldtype:not(:has([data-asset-picker])) > * {
@apply shadow-ui-sm;
td {
/* Table UI Mode: the row has 3+ cells if this one is 3rd or later from either end, or the middle of three */
.grid-table .grid-cell.assets-fieldtype:is(:nth-child(n+3), :nth-last-child(n+3), :nth-child(2):nth-last-child(2)) {
> [data-ui-input-group]:not(:has([data-asset-picker])) {
@apply shadow-ui-sm;
}
[data-asset-browser]:not([data-asset-picker-visible]) td {
padding: 0.3125rem;
}

@jaygeorge jaygeorge Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a knock on effect, which you can see in these screenshots, so let's leave this one.

V6

Image

After this change

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :D I tried to fix this in 0149199c0 so nested grids get the compact styling again (should now match your V6 screenshot :D) but still without the :has().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, nice work getting the selector maths to line up with v6! 🙌

I'm not sure the grid changes are buying us much speed, though. v6's :has() rules here only look inside a single row or cell, so they're fairly cheap to re-check, and the new version still keeps a :has([data-asset-picker]) anyway. I suspect the big wins came from the page-wide ones (.form-group :has(> &), group-has-*, the architectural lines, the [style*="display: none"] one) and the Tabs deep watch, which are brilliant finds.

Unless you saw a noticeable difference from this one on your end, I'd be tempted to leave it out of this PR to keep things simple 😄

@jaygeorge jaygeorge left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Oli, I've suggested one change should be reverted but the rest don't cause any regressions, so if you revert lines 133 ~ 145 in grid.css then all good with me 👍

P.s. I've only checked the impact of the CSS file changes, I'll leave the rest for the team to pick up.

@o1y
o1y requested a review from jaygeorge October 20, 2026 14:27
@jasonvarga
jasonvarga merged commit 833dd96 into statamic:6.x Oct 20, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants