diff --git a/app/helpers/avo/application_helper.rb b/app/helpers/avo/application_helper.rb index af231f14b..d3bc0f216 100644 --- a/app/helpers/avo/application_helper.rb +++ b/app/helpers/avo/application_helper.rb @@ -65,7 +65,7 @@ def svg(file_name, **args) file_name = "#{file_name}.svg" unless file_name.end_with? ".svg" - Avo::CACHED_SVGS[file_name] ||= with_asset_finder(::Avo::SvgFinder) do + with_asset_finder(::Avo::SvgFinder) do inline_svg file_name, **args end end diff --git a/lib/avo/svg_finder.rb b/lib/avo/svg_finder.rb index cc3fd4e3b..91b093137 100644 --- a/lib/avo/svg_finder.rb +++ b/lib/avo/svg_finder.rb @@ -9,13 +9,15 @@ def initialize(filename) # Use the default static finder logic. If that doesn't find anything, search according to our pattern: def pathname - found_asset = default_strategy + Avo::CACHED_SVGS[@filename] ||= begin + found_asset = default_strategy - # Use the found asset - return found_asset if found_asset.present? + # Use the found asset + return found_asset if found_asset.present? - paths.find do |path| - File.exist? path + paths.find do |path| + File.exist? path + end end end