{"data":{"id":"magento2-35580","source":"github-pr","sourceRef":"magento/magento2#35580","title":"Code cleanup and add new critical head block and move critical css before assets","pr":{"number":35580,"url":"https://github.com/magento/magento2/pull/35580","author":"in-session","mergedAt":"2024-07-14T04:11:58Z","mergeCommit":"7167ab9e300b515e710990fd0178617df0058332","headCommit":"03648ecf2399ad2d01d4fa0813d2fa713715479b","baseRef":"2.4-develop","diffSha256":"08965049729755c46dcec4e9f6ee86b65e8fa296ddb192f7137121214b59d0f2"},"issues":[{"number":38748,"url":"https://github.com/magento/magento2/issues/38748","title":"[Issue] Code cleanup and add new critical head block and move critical css before assets","labels":["Area: Performance","Component: Frontend","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"pr-derived"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"reportedOn":null,"codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"conflict"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10"],"components":["magento/framework","magento/module-catalog","magento/module-theme"],"files":[{"path":"app/code/Magento/Catalog/view/frontend/layout/default.xml","change":"modified","package":"magento/module-catalog"},{"path":"app/code/Magento/Theme/view/base/templates/root.phtml","change":"modified","package":"magento/module-theme"},{"path":"app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml","change":"modified","package":"magento/module-theme"},{"path":"lib/internal/Magento/Framework/View/Page/Config/Renderer.php","change":"modified","package":"magento/framework"},{"path":"lib/internal/Magento/Framework/View/Result/Page.php","change":"modified","package":"magento/framework"}],"stripped":{"tests":[],"docs":[],"outsideCode":[]},"linesChanged":177,"mergeBatched":false,"excluded":null,"sections":{"description":"The critical css should appear before the assets. In addition, the changes provide many more opportunities to insert custom blocks between the meta details and assets via template or xml blocks. These include, for example, own meta specifications which are not controllable via XML, as well as assets from the template which must be inserted before other files, for example, constentscripts or special preloads, og:meta tags.","stepsToReproduce":"1. Use CSS critical path","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":["Performance"],"component":["Frontend"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Performance"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"e5188e487f32f3f715b32211df87cfcb0ad9ae267c25aa9532a669129f8c833d","isBugfix":0.1334,"changeKind":{"choice":"refactor","probabilities":{"bugfix":0.0784,"feature":0.3556,"refactor":0.5477,"tests_only":0.0064,"docs_only":0.0051,"dependency":0.0068},"confidence":0.3193},"scope":{"score":1.5197,"probabilities":{"0":0.0473,"1":0.3857,"2":0.567},"confidence":0.2087},"risk":{"score":0.8324,"probabilities":{"0":0.2106,"1":0.7464,"2":0.043},"confidence":0.4049},"area":{"choice":"frontend","probabilities":{"catalog":0.0187,"checkout":0.0075,"customer":0.0052,"admin":0.0082,"graphql_api":0.0045,"framework":0.2742,"frontend":0.6674,"other":0.0143},"confidence":0.453},"securityRelevant":0.0083,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.006,"2.4.0-p1":0.005,"2.4.1":0.0053,"2.4.1-p1":0.0048,"2.4.2":0.0083,"2.4.2-p1":0.0082,"2.4.2-p2":0.0105,"2.4.3":0.0151,"2.4.3-p1":0.0125,"2.4.3-p2":0.0176,"2.4.3-p3":0.0097,"2.4.4":0.0166,"2.4.4-p1":0.0096,"2.4.4-p10":0.0075,"2.4.4-p11":0.0091,"2.4.4-p12":0.0081,"2.4.4-p13":0.0073,"2.4.4-p14":0.0089,"2.4.4-p15":0.007,"2.4.4-p16":0.0078,"2.4.4-p17":0.0077,"2.4.4-p18":0.0064,"2.4.4-p2":0.0036,"2.4.4-p3":0.0042,"2.4.4-p4":0.004,"2.4.4-p5":0.0045,"2.4.4-p6":0.0063,"2.4.4-p7":0.0052,"2.4.4-p8":0.006,"2.4.4-p9":0.0049,"2.4.5":0.0196,"2.4.5-p1":0.0127,"2.4.5-p10":0.0083,"2.4.5-p11":0.0116,"2.4.5-p12":0.0103,"2.4.5-p13":0.0098,"2.4.5-p14":0.0105,"2.4.5-p15":0.0072,"2.4.5-p16":0.0098,"2.4.5-p17":0.0083,"2.4.5-p2":0.0047,"2.4.5-p3":0.006,"2.4.5-p4":0.0065,"2.4.5-p5":0.0062,"2.4.5-p6":0.0068,"2.4.5-p7":0.0075,"2.4.5-p8":0.0051,"2.4.5-p9":0.0065,"2.4.6":0.0274,"2.4.6-p1":0.0189,"2.4.6-p10":0.0122,"2.4.6-p11":0.0124,"2.4.6-p12":0.0134,"2.4.6-p13":0.0107,"2.4.6-p14":0.0118,"2.4.6-p15":0.0094,"2.4.6-p2":0.0055,"2.4.6-p3":0.0086,"2.4.6-p4":0.0103,"2.4.6-p5":0.0083,"2.4.6-p6":0.0161,"2.4.6-p7":0.0094,"2.4.6-p8":0.0088,"2.4.6-p9":0.0063,"2.4.7":0.0192,"2.4.7-p1":0.015,"2.4.7-p10":0.0098,"2.4.7-p2":0.0093,"2.4.7-p3":0.0146,"2.4.7-p4":0.0151,"2.4.7-p5":0.0144,"2.4.7-p6":0.0157,"2.4.7-p7":0.0142,"2.4.7-p8":0.0109,"2.4.7-p9":0.0072,"2.4.8":0.0212,"2.4.8-p1":0.0168,"2.4.8-p2":0.0206,"2.4.8-p3":0.0187,"2.4.8-p4":0.0165,"2.4.8-p5":0.0158,"2.4.9":0.0216,"unspecified":0.1388},"confidence":0.0185},"backportWorthy":{"score":0.7425,"probabilities":{"0":0.4159,"1":0.4258,"2":0.1583},"confidence":0.069}},"curated":{"title":"Renders critical CSS before assets and adds a critical head block","description":"The critical css block (dev/css/use_css_critical_path) is in head.additional, so it does not appear before the assets. A new head.critical block now sits in root.phtml between the head content and the assets, the critical css block is put in it, and the page config Renderer gets a renderHeadAssets function taken out of renderHeadContent, with code cleanup.","categories":["Performance"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":null},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-35580 details"}