From de6d70cc2efa1aa3f972d2bb1427a1731c9c2710 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Fri, 20 Feb 2026 11:45:06 +0100 Subject: [PATCH] Bump turbo-rails for Turbo.offline.clearCache() Simplify the clear-offline-cache controller to use the new Turbo.offline.clearCache() API instead of messaging the service worker directly. Co-Authored-By: Claude Opus 4.6 --- Gemfile.lock | 2 +- Gemfile.saas.lock | 2 +- .../controllers/clear_offline_cache_controller.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 758936188..8a49b38a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GIT GIT remote: https://github.com/hotwired/turbo-rails.git - revision: ca62e8bdad88d01914d512ad24424e0670f239c9 + revision: 4104a353cfe728232dc0eed6d54c77466a9849f2 branch: offline-cache specs: turbo-rails (2.0.23) diff --git a/Gemfile.saas.lock b/Gemfile.saas.lock index a3552dacd..751dc55fb 100644 --- a/Gemfile.saas.lock +++ b/Gemfile.saas.lock @@ -62,7 +62,7 @@ GIT GIT remote: https://github.com/hotwired/turbo-rails.git - revision: ca62e8bdad88d01914d512ad24424e0670f239c9 + revision: 4104a353cfe728232dc0eed6d54c77466a9849f2 branch: offline-cache specs: turbo-rails (2.0.23) diff --git a/app/javascript/controllers/clear_offline_cache_controller.js b/app/javascript/controllers/clear_offline_cache_controller.js index bc0511a7f..7caa2e89b 100644 --- a/app/javascript/controllers/clear_offline_cache_controller.js +++ b/app/javascript/controllers/clear_offline_cache_controller.js @@ -1,8 +1,8 @@ import { Controller } from "@hotwired/stimulus" +import { Turbo } from "@hotwired/turbo-rails" export default class extends Controller { - async clearCache() { - const registration = await navigator.serviceWorker?.ready - registration?.active?.postMessage({ action: "clearCache" }) + clearCache() { + Turbo.offline.clearCache() } }