From e8920ceb0e77f1fa4438e5e357e7ca5487dadb12 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 13 Nov 2025 16:03:48 +0100 Subject: [PATCH] Prevent page refreshes when posting comments/descriptions with attachments --- ...e_storage_analyze_job_suppress_broadcasts.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/rails_ext/active_storage_analyze_job_suppress_broadcasts.rb diff --git a/lib/rails_ext/active_storage_analyze_job_suppress_broadcasts.rb b/lib/rails_ext/active_storage_analyze_job_suppress_broadcasts.rb new file mode 100644 index 000000000..ba22603b6 --- /dev/null +++ b/lib/rails_ext/active_storage_analyze_job_suppress_broadcasts.rb @@ -0,0 +1,17 @@ +# Avoid page refreshes from Active Storage analyzing blobs when these are attached. +# +# A better option would be to disable touching with +touch_attachment_records+ but +# there is currently a bug https://github.com/rails/rails/issues/55144 +module ActiveStorageAnalyzeJobSuppressBroadcasts + def perform(blob) + Board.suppressing_turbo_broadcasts do + Card.suppressing_turbo_broadcasts do + super + end + end + end +end + +ActiveSupport.on_load :active_storage_blob do + ActiveStorage::AnalyzeJob.prepend ActiveStorageAnalyzeJobSuppressBroadcasts +end