diff --git a/Gemfile b/Gemfile index 2a4e40422db..c89b14189e1 100644 --- a/Gemfile +++ b/Gemfile @@ -64,7 +64,6 @@ gem 'rack-timeout', require: false gem 'redacted_struct' gem 'redis', '>= 3.2.0' gem 'redis-session-store', github: '18F/redis-session-store', tag: 'v1.0.1-18f' -gem 'request_store', '~> 1.0' gem 'retries' gem 'rotp', '~> 6.1' gem 'rqrcode' diff --git a/Gemfile.lock b/Gemfile.lock index 0b726685692..d0258b2095f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -835,7 +835,6 @@ DEPENDENCIES redacted_struct redis (>= 3.2.0) redis-session-store! - request_store (~> 1.0) retries rotp (~> 6.1) rqrcode diff --git a/app/helpers/script_helper.rb b/app/helpers/script_helper.rb index 885f19df59d..54171c9d7d5 100644 --- a/app/helpers/script_helper.rb +++ b/app/helpers/script_helper.rb @@ -1,13 +1,9 @@ # frozen_string_literal: true +# rubocop:disable Rails/HelperInstanceVariable module ScriptHelper def javascript_packs_tag_once(*names, **attributes) - scripts = RequestStore.store[:scripts] - if scripts - RequestStore.store[:scripts].merge!(names.index_with(attributes)) - else - RequestStore.store[:scripts] = names.index_with(attributes) - end + @scripts = @scripts.to_h.merge(names.index_with(attributes)) nil end @@ -16,9 +12,9 @@ def javascript_packs_tag_once(*names, **attributes) def render_javascript_pack_once_tags(...) capture do javascript_packs_tag_once(...) - return if RequestStore.store[:scripts].blank? + return if @scripts.blank? concat javascript_assets_tag - RequestStore.store[:scripts].each do |name, attributes| + @scripts.each do |name, attributes| asset_sources.get_sources(name).each do |source| concat javascript_include_tag( source, @@ -46,7 +42,7 @@ def local_crossorigin_sources? end def javascript_assets_tag - assets = asset_sources.get_assets(*RequestStore.store[:scripts].keys) + assets = asset_sources.get_assets(*@scripts.keys) if assets.present? asset_map = assets.index_with { |path| asset_path(path, host: asset_host(path)) } @@ -71,3 +67,4 @@ def asset_host(path) end end end +# rubocop:enable Rails/HelperInstanceVariable diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3bb6446ceb6..04b0c431cdd 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -121,7 +121,6 @@ class Analytics end config.before(:each) do - RequestStore.clear! Rails.cache.clear end