Template API - sub-template in dom-repeat

Hi, i would like to use a sub-layout in a dom-repeat block.
While

<dom-module id="parent-layout">
    <template>
        <h1>Parent</h1>
        <sub-layout></sub-layout>
    </template>
	...
</dom-module>

works (having a @Uses(SubLayout.class) annotation in the ParentLayout Java-Class), the following does not work:

<dom-module id="parent-layout">
    <template>
        <h1>Parent</h1>
        <dom-repeat items="{{myItems}}">
            <template>
                <sub-layout></sub-layout>
            </template>
        </dom-repeat>
    </template>
	...
</dom-module>

The following Exception occurs:

ERROR com.vaadin.flow.router.InternalServerError - There was an exception while trying to navigate to ''
java.lang.IllegalArgumentException: Unable to create an instance of 'com.test.markus.ui.ParentLayout'. The constructor threw an exception.
(...)
Caused by: java.lang.IllegalStateException: Couldn't parse the template 'frontend://src/views/parent-layout.html': sub-templates are not supported. Sub-template found: 
'<sub-layout></sub-layout>'

Is there a way to achieve such a behavior?

I’m using Vaadin 10.

Hi Markus,
this is a known limitation.
Subtemplates can’t be used in dynamic structures.
By subtemplate I mean a Java Polymer template class which is connected to the client side polymer template.
You can use subtemplate which are pure client side (without a server side counterpart) without any problem.
But it’s not possible to use subtemplate which has a Java component class in constructions like dom-repeat or dom-if.

The reason is : we should repeat the client side logic to understand how many instances should be created on the server side. And this is near to impossible: client side engine needs to be repeated on the server side.

So Java subtemplates work only within static constructions where it’s easy to know how many instances should be created on the server side.