Share toc id between TocChunkerFormatter and SectorTocBlock

Created on 16 August 2024, 3 months ago
Updated 15 September 2024, 2 months ago

Problem/Motivation

When the SectorTocBlock block and TocChunkerFormatter field formatter are rendered on the same page they both make a call to TocManager to create a table of contents with the same field data.

TocManager statically caches the ToC - but we are not retrieving this at any point and end up initializing the same field value twice. This can be expensive when dealing with content that has a lot of elements.

Proposed resolution

Use the same id in the block and field formatted so an existing ToC can be reused if either has initialized it already.

The key should be unique to the node being rendered and the type of toc being generated (for reference - the module currently hard codes sector_toc in the toc block, but allows any toc to be configured in the field formatter. If these are different, then they should not share the same toc instance).

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇳🇿New Zealand ericgsmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024