Cache-related template tag's like Django's {% cache %} and Wagtail's {% wagtailcache %} and {% wagtailpagecache %} work by attempting to render a cached fragment, falling back to rendering the child nodes and storing the result in the cache.
When viewing patterns in the pattern library, particularly during local development, this is not what you want. You want to be able to instantly view changes made to the template. Additionally, context required to generate cache keys, such as page.cache_key in the case of {% wagtailpagecache %} may not be present in the pattern library context.
Describe the solution you'd like
I propose the DPL should have a no-op tag that unconditionally renders it's children and the ability to specify by name the tags that should be replaced with the no-op tag implementation in pattern library contexts. Config for this might look something like the following:
Is your proposal related to a problem?
Cache-related template tag's like Django's
{% cache %}
and Wagtail's{% wagtailcache %}
and{% wagtailpagecache %}
work by attempting to render a cached fragment, falling back to rendering the child nodes and storing the result in the cache.When viewing patterns in the pattern library, particularly during local development, this is not what you want. You want to be able to instantly view changes made to the template. Additionally, context required to generate cache keys, such as
page.cache_key
in the case of{% wagtailpagecache %}
may not be present in the pattern library context.Describe the solution you'd like
I propose the DPL should have a no-op tag that unconditionally renders it's children and the ability to specify by name the tags that should be replaced with the no-op tag implementation in pattern library contexts. Config for this might look something like the following:
Maybe
["cache"]
should be the default value for this?