lib/lookbook/entities/collections/preview_collection.rb in lookbook-2.0.4 vs lib/lookbook/entities/collections/preview_collection.rb in lookbook-2.0.5
- old
+ new
@@ -41,9 +41,16 @@
paths = Array(paths).map(&:to_s)
@entities.reject! { |preview| preview.file_path.to_s.in?(paths) }
clear_cache
end
+ def entities
+ @_cache[:entities] ||= begin
+ all = collect_ordered_entities(to_tree(include_hidden: true))
+ all.filter { _1.is_a?(Lookbook::PreviewEntity) }
+ end
+ end
+
class << self
def preview_from_code_object(code_object)
klass = code_object.path.constantize
if preview_class?(klass)
preview = PreviewEntity.new(code_object)