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.

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. I discovered this issue when some functionality stopped working after 2.6 -> 2.8 update of the module. The issues were already reported here.

After some debugging, I found that the issues are fixed after I made sure the browser cache is cleared and the latest assets are loaded.

There could be other reported issues related to this.

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.

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

keszthelyi created an issue. See original summary.

himanshu_jhaloya’s picture

Assigned: Unassigned » himanshu_jhaloya

https://www.drupal.org/project/field_group/issues/3163971 Related Remove VERSION from libraries.yml

himanshu_jhaloya’s picture

Assigned: himanshu_jhaloya » Unassigned
Status: Active » Needs review
keszthelyi’s picture

Patch from commit 582fe683

kthull’s picture

So glad I tried the patch in #4 since I was just getting never-ending throbber with no errors, making troubleshooting tricky.

Confirming this fixes my issue with v2.8

drupalgreenhorn’s picture

keszthelyi

I tested the patch 4, it didn't fix the issue

so at this moment, with
Drupal core 9.5.3
we still have same issue with
entity_browser 8.x-2.9 (security update)

we still have to use entity_browser 8.x-2.6 so general user can create a new app with Entity Browser

Did you upgraded to Drupal core 9.5.3 and entity_browser 8.x-2.9 successfully?

Thank you

dave reid’s picture

StatusFileSize
new1.87 KB

Updated patch against current 8.x-2.x.

  • Dave Reid committed 665735c1 on 8.x-2.x
    Issue #3325948 by keszthelyi, Dave Reid: Fixed libraries should not use...
dave reid’s picture

Status: Needs review » Fixed

Committed to 8.x-2.x.

Status: Fixed » Closed (fixed)

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