From b7a910b758829d29327411d13e59ae366e01e0a5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Oct 2026 00:08:05 +0800 Subject: [PATCH] fix(scripts): bust tbquire module cache with newest runtime/*.js mtime _win.ver only tracked main.min.js, so rebuilding svg-icon.js alone kept serving the cached sprite and new icons (ticket-color) rendered blank. Co-Authored-By: Claude Fable 5 --- src/Core/ScriptsPart1c.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/ScriptsPart1c.php b/src/Core/ScriptsPart1c.php index 911a673d..ac3e95ee 100644 --- a/src/Core/ScriptsPart1c.php +++ b/src/Core/ScriptsPart1c.php @@ -147,8 +147,12 @@ trait ScriptsPart1c { */ private function enqueue_public_fonts_js_and_data($base_uri, $core_dep, $deps, $is_fixed_homepage, $is_home_or_archive, $is_single_post, $is_single_resource, $version, array $singular_assets): void { $runtime_uri = $base_uri . '/assets'; - $runtime_main_path = get_template_directory() . '/assets/js/runtime/main.min.js'; - $runtime_version = file_exists($runtime_main_path) ? (string) filemtime($runtime_main_path) : $version; + // tbquire 的 urlArgs 统一用此版本号;取所有按需加载模块中最新的 mtime,任何模块重建都会刷新缓存。 + $runtime_mtimes = array_map( + 'filemtime', + glob(get_template_directory() . '/assets/js/runtime/*.js') ?: [] + ); + $runtime_version = $runtime_mtimes !== [] ? (string) max($runtime_mtimes) : $version; $loader_path = get_template_directory() . '/assets/js/runtime/loader.js'; $bootstrap_path = get_template_directory() . '/assets/js/runtime/libs/bootstrap.min.js'; $post_page_settings = class_exists('\AKSRT\Settings\Settings')