Prefetching Issue: Libraries attached in node templates are not prefetched

Created on 8 July 2024, 4 months ago

Problem/Motivation

When adding a node URL, such as /node/1, to the list of URLs to be prefetched in a PWA module, the associated libraries defined within the node's template (e.g., node--1.html.twig with {{ attach_library('euaa_base/pwa_test') }}) are not being prefetched. This issue impacts the performance and efficiency of the PWA module as the necessary libraries are not available when needed.

Steps to reproduce

  1. Add a node URL (e.g., /node/1) to the list of URLs to be prefetched in the PWA module.
  2. Ensure that the node template (node--1.html.twig) includes a library attachment (e.g., {{ attach_library('euaa_base/pwa_test') }}).
  3. Load the PWA page (in the offline mode) and observe that the specified library is not prefetched as expected.

Proposed resolution

I propose to investigate and modify the PWA module to ensure that libraries attached within node templates are properly prefetched when the corresponding node URL is added to the prefetch list. This might involve changes to the way the PWA module handles library dependencies for prefetched URLs.

Remaining tasks

  • Review the current implementation of URL prefetching in the PWA module.
  • Identify where the library attachments are being missed.
  • Implement a solution to include these libraries in the prefetch process.
  • Test the changes thoroughly with various node templates and library attachments.
  • Document the changes and update relevant module documentation.

User interface changes

No user interface changes are expected as this issue pertains to background functionality related to prefetching.

API changes

No API changes are anticipated at this stage.

Data model changes

No changes to the data model are required for this resolution.

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇨🇿Czech Republic kryber

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

Comments & Activities

Production build 0.71.5 2024