diff --git a/src/core/__tests__/template.test.tsx b/src/core/__tests__/template.test.tsx index eb07d931..241bcaf9 100644 --- a/src/core/__tests__/template.test.tsx +++ b/src/core/__tests__/template.test.tsx @@ -532,6 +532,10 @@ describe("component/render in nested options", () => { + + + + ); @@ -543,6 +547,7 @@ describe("component/render in nested options", () => { expect(options["collection[3].template"]).toBe("collection[3].template"); expect(options["collection[4].template"]).toBe(undefined); expect(options["collection[5].template"]).toBe(undefined); + expect(options["collection[6].template"]).toBe(undefined); expect(options["option.item"]).toBe(undefined); expect(options["option.template"]).toBe(undefined); diff --git a/src/core/options-manager.ts b/src/core/options-manager.ts index 9302ea3d..f7bf5d92 100644 --- a/src/core/options-manager.ts +++ b/src/core/options-manager.ts @@ -219,9 +219,13 @@ class OptionsManager { ); const nestedObjects = this._getNestedOptionsObjects(e.children, templateRegistrationRequired); + const nestedObjectsCount = Object.keys(nestedObjects).reduce((acc, item) => { + const obj = nestedObjects[item]; + return acc + (Array.isArray(obj) ? obj.length : 1); + }, 0); const hasChildrenForTemplate = - ReactChildren.count(e.element.props.children) > Object.keys(nestedObjects).length; + ReactChildren.count(e.element.props.children) > nestedObjectsCount; if (templateRegistrationRequired) { this._templateHost.add({