When rendering the same snippet multiple times on a page with different variables, metaobjects become inaccessible (return null) in some instances
This occurs despite the metaobjects being:
- Active in status
- Properly published
- Accessible in some renderings of the same snippet
Example of our snippet (card.liquid
):
{% assign widget_metaobject_type = 'app--' | append: app_id | append: '--widgets' %}
{% assign page_metaobject_handle = 'PRODUCT' | append: product.id | append: layer %}
{% assign playlist_metaobject = shop.metaobjects[widget_metaobject_type][page_metaobject_handle] %}
How we’re including it multiple times:
{% render 'cards', layer: 5, block_settings: block.settings, legacy: true %}
{% render 'cards', layer: 6, block_settings: block.settings, legacy: true %}
{% render 'cards', layer: 7, block_settings: block.settings, legacy: true %}
{% render 'cards', layer: 8, block_settings: block.settings, legacy: true %}
As you can see only the page_metaobject_handle
changes which depends on the layer variables which is being passed to snippet from embed.liquid
We have confimed that all metaobjects exists, but for some reason, for example layer 7, 8 metaobjects return null, same code, nothing changes. it just is not accesible. When we remove layer 5,6 without making any change whatsover, suddenly layer 7,8 snippets starts working.
Current behavior:
- First few renderings of the snippet: metaobjects are accessible
- Later renderings: metaobjects return null
- The same metaobject is visible and active in the admin panel (verified using admin api)
- No changes were made to the metaobject configuration
Interesting Pattern:
- When the same snippet is rendered fewer times, all instances can access the metaobjects
- As the number of renderings increases, more instances fail to access the metaobjects
- This suggests a potential limitation or performance issue with multiple metaobject lookups in repeated snippet renders
Questions:
- Is there a limit to how many times we can look up the same metaobject type in different snippet renderings?
- Could this be related to some form of rate limiting or caching?