lib/lookbook/engine.rb in lookbook-2.0.0.beta.2 vs lib/lookbook/engine.rb in lookbook-2.0.0.beta.3

- old
+ new

@@ -24,11 +24,11 @@ config.lookbook.using_view_component = false end end config.after_initialize do - if opts.using_view_component || Rails.env.test? + if opts.using_view_component vc_config = Engine.host_config.view_component opts.preview_paths += vc_config.preview_paths opts.preview_controller = vc_config.preview_controller opts.preview_layout = vc_config.default_preview_layout @@ -127,17 +127,21 @@ def host_config Rails.application.config end def view_paths - ActionView::ViewPaths.all_view_paths.flat_map do |view_path| - view_path.paths.map { |path| Pathname(path.to_s) } + # handle view path registry changes in Rails 7.1 + paths = if defined?(ActionView::ViewPaths::Registry) + ActionView::ViewPaths::Registry.all_file_system_resolvers.map(&:path) + else + ActionView::ViewPaths.all_view_paths.flat_map(&paths) end + paths.map { |path| Pathname(path.to_s) } end def component_paths @_component_paths ||= begin - paths = [*opts.component_paths, *Engine.view_paths, host_app_path] + paths = [*opts.component_paths, *view_paths, host_app_path] PathUtils.normalize_paths(paths) end end def page_paths