Clear offline cache when logging out

Adds a logout Stimulus controller that sends a message to the service
worker to clear all cached content when the user logs out. This ensures
that cached data from one user isn't accessible after logout.

The implementation:
- Adds logout_controller.js that posts { action: "clearCache" } to the
  service worker via postMessage
- Updates logout buttons to use the controller on form submission

Also fixes data-turbo placement: moved from button to form element where
it actually takes effect for disabling Turbo Drive form submissions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-01-27 09:32:15 +01:00
parent 975968b50f
commit a949f1e3ae
5 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ GIT
GIT
remote: https://github.com/hotwired/turbo-rails.git
revision: 49be3f2d43edeeedad48cb492b35242fdb27af74
revision: 45a2a40be0a677808a3a269311f1b5abaa3b30ba
branch: offline-cache
specs:
turbo-rails (2.0.21)