Problem/Motivation

Over at #2254865-37: toolbar_pre_render() runs on every page and is responsible for ~15ms/17000 function calls it is impossible to add the cacheable metadata to the link itself.

Proposed resolution

- Add a new parameter for #theme => links, 'links' property to allow setting cacheability as a CacheableMetadata object (or render array) directly on the link.

Useful:

CacheableMetadata::fromRenderArray($cacheable_render_array)
->applyTo($link);

Or

$cacheable_metadata->applyTo($link);

directly (if using the object route).

Remaining tasks

- Do it

User interface changes

- None

API changes

- API addition to #theme links definition

Files: 
CommentFileSizeAuthor
#5 interdiff.txt1.67 KBWim Leers
#5 type_links_cacheability_individual_links-2495779-5.patch2.35 KBWim Leers
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 95,214 pass(es), 60 fail(s), and 36 exception(s). View

Comments

Wim Leers’s picture

Component: cache system » base system
Status: Active » Needs review
FileSize
724 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 95,237 pass(es), 57 fail(s), and 0 exception(s). View

Isn't this what you want?

Wim Leers’s picture

(#1 is not what the IS suggests, but AFAICT it's even better.)

Wim Leers’s picture

Status: Needs review » Needs work

The last submitted patch, 1: type_links_cacheability_individual_links-2495779-1.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
2.35 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 95,214 pass(es), 60 fail(s), and 36 exception(s). View
1.67 KB

So this unbreaks HEAD, because now CommentPostRenderCache::attachNewCommentsLinkMetadata() is being called again, and hence the last user of ['#attached']['js'] is uncovered.

Fixing it.

Status: Needs review » Needs work

The last submitted patch, 5: type_links_cacheability_individual_links-2495779-5.patch, failed testing.

Fabianx’s picture

The patches are for #2496399: Comment module's node links' front-end perf-optimizing drupalSettings are missing.

This approach here is for #theme => 'links' and has nothing to do with drupal_pre_render_links().

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.