mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 09:20:42 -07:00
Ensure that partial caches are shared with subcontexts
Make Context use StaticRegisters by default. This makes it easier to ensure that all subcontexts share the same static registers. Co-authored-by: Dylan Thacker-Smith <[email protected]>
This commit is contained in:
co-authored by
Dylan Thacker-Smith
parent
1cae1e497f
commit
6c2c621712
@@ -3,16 +3,16 @@
|
||||
module Liquid
|
||||
class PartialCache
|
||||
def self.load(template_name, context:, parse_context:)
|
||||
cached_partials = (context.registers[:cached_partials] ||= {})
|
||||
cached_partials = context.registers[:cached_partials]
|
||||
cached = cached_partials[template_name]
|
||||
return cached if cached
|
||||
|
||||
file_system = (context.registers[:file_system] ||= Liquid::Template.file_system)
|
||||
file_system = context.registers[:file_system]
|
||||
source = file_system.read_template_file(template_name)
|
||||
|
||||
parse_context.partial = true
|
||||
|
||||
template_factory = (context.registers[:template_factory] ||= Liquid::TemplateFactory.new)
|
||||
template_factory = context.registers[:template_factory]
|
||||
template = template_factory.for(template_name)
|
||||
|
||||
partial = template.parse(source, parse_context)
|
||||
|
||||
Reference in New Issue
Block a user