diff --git a/src/component/directive.ts b/src/component/directive.ts
index 73cc5eb7..27b46cde 100644
--- a/src/component/directive.ts
+++ b/src/component/directive.ts
@@ -245,7 +245,7 @@ QWeb.addDirective({
? `key${keyID}`
: ctx.inLoop
? ctx.currentKey
- ? `String(${ctx.currentKey} + '_k_' + i)`
+ ? `String(${ctx.currentKey} + '_k_' + i + '_c_' + ${componentID} )`
: `String(-${componentID} - i)`
: String(componentID);
if (ctx.allowMultipleRoots) {
diff --git a/tests/component/__snapshots__/component.test.ts.snap b/tests/component/__snapshots__/component.test.ts.snap
index 38ad8287..5efc08d6 100644
--- a/tests/component/__snapshots__/component.test.ts.snap
+++ b/tests/component/__snapshots__/component.test.ts.snap
@@ -1375,7 +1375,7 @@ exports[`t-slot directive slots are rendered with proper context, part 2 2`] = `
c2.push(vn6);
//COMPONENT
let def8;
- let templateId10 = String(nodeKey6 + '_k_' + i);
+ let templateId10 = String(nodeKey6 + '_k_' + i + '_c_' + 9 );
let w9 = templateId10 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId10]] : false;
let _7_index = c6.length;
c6.push(null);
@@ -1464,7 +1464,7 @@ exports[`t-slot directive slots are rendered with proper context, part 3 2`] = `
var _7 = 'User '+context['user'].name;
//COMPONENT
let def9;
- let templateId11 = String(nodeKey6 + '_k_' + i);
+ let templateId11 = String(nodeKey6 + '_k_' + i + '_c_' + 10 );
let w10 = templateId11 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[templateId11]] : false;
let _8_index = c6.length;
c6.push(null);
diff --git a/tests/component/component.test.ts b/tests/component/component.test.ts
index 56522a96..7ce97431 100644
--- a/tests/component/component.test.ts
+++ b/tests/component/component.test.ts
@@ -1373,6 +1373,33 @@ describe("composition", () => {
);
});
+ test("list of two sub components inside other nodes", async () => {
+ // this confuses the patching algorithm...
+ env.qweb.addTemplate("ChildWidget", `child`);
+
+ env.qweb.addTemplates(`
+