Skip to content

Cache busting does not account for changes to main.js #1791

@Toutouwai

Description

@Toutouwai

Short description of the issue

After upgrading the PW version of a site I get this error:

Uncaught TypeError: ProcessWire.trim is not a function at urlKeydown (ProcessPageEditLink.min.js?v=112-1689898720:1:3921)

ProcessWire.trim() was added in PW 3.0.216: https://github.com/processwire/processwire/blob/c1a939be0cd4ad3f49b7cd1b38dd5d5cb588021c/wire/templates-admin/scripts/main.js#L534

But the cache-busting version string for main.js only changes based on the version number of the AdminTheme:
https://github.com/processwire/processwire/blob/c1a939be0cd4ad3f49b7cd1b38dd5d5cb588021c/wire/modules/AdminTheme/AdminThemeUikit/_head.php#L17
https://github.com/processwire/processwire/blob/c1a939be0cd4ad3f49b7cd1b38dd5d5cb588021c/wire/modules/AdminTheme/AdminThemeUikit/_head.php#L29

The version number of AdminThemeUikit hasn't changed since May 2021: processwire/processwire@401fcb0
And the letter suffix hasn't changed since July 2021: processwire/processwire@003c7f9#diff-64a4fd5ec14df300f1835eab32deff8cd30897483596b07c4cb6f5e47ddb0e6c

This approach to cache-busting seems fraught with risk because any time there is a change to admin JS/CSS assets Ryan will need to remember to update the version for admin theme(s).

Would it not be better to use filemtime() for the cache-busting string? There would be some small overhead but worth it to avoid issues like this IMO.

Setup/Environment

  • ProcessWire version: 3.0.223

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions