Problem/Motivation

The version: VERSION lines in libraries.yml are creating a version query string using the Drupal Core version number for the asset files, making these files cached in the browser dependent on the Core version.

This is a duplicate of #3495652 that was reverted with the merged change in #3589260. I do not think this part of the change was intentional.

Steps to reproduce

This can produce various problems after an update, as the old versions of assets might be loaded for users who have those cached. The only way to currently fix those to clear the browser cache.

Proposed resolution

Remove the version: VERSION lines from libraries.yml. By doing this, Drupal will use an automatically generated query string added to filenames. From the code documentation:

The string changes on every update or full cache flush, forcing browsers to load a new copy of the files as the URL changed.

See: web/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php:62

The other option is to explicitly set the module's version on these lines and keep track of it when the version number changes/the asset is updated.

Issue fork linkit-3633262

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kasperg created an issue. See original summary.

kasperg’s picture

Status: Active » Needs review

MR !191 removes the version: 1.0.0 line from the linkit.autocomplete library, so the autocomplete script gets the same cache-busting query string as the other Linkit assets again.

To verify: on 7.x the script loads as linkit.autocomplete.js?v=1.0.0. With the change applied and caches rebuilt it loads with the same token as linkit.js, and the token changes on every cache rebuild. Verified on Drupal 10.6 with Linkit 7.0.16.

mark_fullmer’s picture

Thanks for pointing this out; I agree that the revert of the version number in #3589260: Linkit autocomplete loses metadata if autocomplete triggered but no selection made was not intentional. Merging and marking as fixed!

mark_fullmer’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.