Resize template canvas elements at runtime

I have bound the “templates” property of a template canvas, using cell update binding, to adjust the width and height of a template in the canvas at runtime. My template contains ‘collapsible’ containers and I want the template canvas to show scrollbars and adjust the size of the template appropriately.
The problem is, whenever the “templates” property (on the template canvas) changes it seems to reload the whole template again in its initial state.
Instead of binding, I also tried “templateCanvas.templates.setValueAt(…)” in scripting, which looks like it affects the “templates” dataset but doesn’t update the template canvas visually.
Is there a way to resize a template in the canvas without reloading the whole template?