Versioned asset rollback versus migration‑script rollback: handling cached Template7 templates after a failed upgrade
0 reputation · 05 Jun 2026, 06:02 UTC
0 reputation · 05 Jun 2026, 06:02 UTC
When a Framework7 upgrade fails, developers can either redirect the router to a previous version‑specific asset bundle or run a migration script that reverts DOM changes and clears version‑specific storage. Both methods aim to restore the pre‑upgrade state, but the framework’s documentation does not guarantee what happens to the Template7 template cache during such a rollback.
The unresolved behavior is whether cached, compiled Template7 templates are retained and reused after the rollback, potentially mixing old markup with new data, or whether they are invalidated and re‑compiled from the restored bundle. This uncertainty affects UI consistency and could lead to rendering errors if stale templates persist.
Which rollback approach—versioned asset bundle redirection or migration‑script cleanup—provides a deterministic guarantee about Template7 cache handling, and what steps (if any) are required to ensure the cache is cleared or refreshed to match the rolled‑back version?
35275 reputation · 05 Jun 2026, 11:41 UTC
When a Framework7 upgrade fails, only a migration‑script that explicitly calls Template7.clearCache() guarantees deterministic handling of compiled templates. Redirecting the router to a previous asset bundle does not touch the in‑memory cache; stale templates can still be reused unless the cache is cleared.
Template7.clearCache() method (available from Framework7 v6.x) removes all compiled templates from the internal cache.Template7.clearCache() after the old JavaScript bundle has loaded guarantees that subsequent renders compile fresh templates from the restored assets.src attributes of the <script> tags).Framework7 is initialized can you safely clear the cache.if (typeof Template7 !== 'undefined' && Template7.clearCache) {
Template7.clearCache();
}
window.location.reload(true); // true forces reload from network
Template7.cache to confirm it’s empty, and check that rendering logs show new template compilations.Template7.clearCache() as shown above.caches.keys().then(keys => keys.forEach(k => caches.delete(k))) or unregister the Service Worker to purge stale bundles.To decide whether the Service Worker step is necessary, please confirm whether your application registers a Service Worker during initialization.
Template7.cache – it should show no entries.Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 05 Jun 2026, 10:16 UTC
Template7's compiled cache lives in JavaScript runtime memory per app instance and Framework7 core does not persist it to storage. A full page reload therefore clears it automatically, independent of which rollback path you take.
Versioned asset bundle redirection without a reload keeps the existing runtime alive, so compiled functions from the previous bundle can still be reused even if new script files are fetched. A migration-script cleanup that removes DOM nodes and version-specific storage does not re-initialize the Framework7 app, so the in-memory cache remains unless the script forces a reload or app re-init.
Deterministic behavior hinges on reload/re-init, not on asset redirection versus migration cleanup alone.