Render dynamic snippet

nchan0154
Tourist
3 0 3

I'm very much looking forward to the new store design experience as I think it will solve a lot of pain points for merchants/clients. While I'm thrilled the snippet functionality has been included in the form of render, I'm a little concerned that there will no longer be support for dynamic includes. Being able to dynamically include snippets allows us to build things like custom icon and illustration libraries into the theme without having a single giant if/switch statement file to serve as a reference lookup.

Relevant forum threads where other developers have expressed concern over removal of this functionality: 

https://community.shopify.com/c/Technical-Q-A/Deprecated-include-tag/m-p/608267#M14659

https://community.shopify.com/c/Shopify-Design/How-Can-I-render-a-snippet-this-name-is-defined-by-a-...

Replies 4 (4)
CharlieCoppinge
Shopify Partner
8 0 4

Hey @nchan0154, we've been discussing this over in the Shopify Partners Slack Community, as well as a post here on the forums:

https://community.shopify.com/c/Technical-Q-A/Using-variables-in-the-new-render-tag/m-p/816294#M2967...

Sadly it doesn't look possible, and as such, it looks like it's a performance priority leading to it being cut

nchan0154
Tourist
3 0 3

@CharlieCoppinge Thank you for alerting me to the slack thread and the related twitter conversation. I am aware that they have given "performance" as a reason for not including this functionality in the past, but I will also note that they had planned to deprecate 'include' entirely with NO replacement for snippets due to performance so at this point I'm just hoping that collectively we can emphasize how important this functionality is to us. Obviously I can't speak to overall engine performance, but I think it is on us as devs to use the functionality responsibly to make sure we don't build slow themes, and I can't say I've been worried about it's rendering performance in the past. For more context, here is a screenshot of the flame graph where we've dynamically included an icon based on a setting. I've circled where the snippet is in blue. ¯\_(ツ)_/¯

Capture.PNG

CharlieCoppinge
Shopify Partner
8 0 4

Thanks for chiming in @nchan0154 - very good points.

I think it is on us as devs to use the functionality responsibly to make sure we don't build slow themes

In my opinion, you've hit the nail on the head here.

Couple this with perhaps a greater emphasis and learning resources on optimization/page speed (optimization dashboard? testing tools? warnings?) and we're onto a winner.

CharlieCoppinge
Shopify Partner
8 0 4

Fair play to Shopify, I just came across this Tweet from a couiple of weeks back:

https://twitter.com/jmwind/status/1282325745352822786

Apaprently a store performance tool is coming to us this month.

Definetly a step in the right direction, but it still stands that giving us access to more advanced tooling is still better than not.