mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
allow drops to optimize loading a slice of elements
This commit is contained in:
@@ -75,8 +75,11 @@ module Liquid
|
||||
limit = context[@attributes['limit']]
|
||||
to = limit ? limit.to_i + from : nil
|
||||
|
||||
|
||||
segment = Utils.slice_collection_using_each(collection, from, to)
|
||||
segment = if (from != 0 || to != nil) && collection.respond_to?(:load_slice)
|
||||
collection.load_slice(from, to)
|
||||
else
|
||||
Utils.slice_collection_using_each(collection, from, to)
|
||||
end
|
||||
|
||||
return render_else(context) if segment.empty?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user