diff --git a/api/src/main/java/jakarta/faces/component/UIViewRoot.java b/api/src/main/java/jakarta/faces/component/UIViewRoot.java index b194487e2..c1f85ee6e 100644 --- a/api/src/main/java/jakarta/faces/component/UIViewRoot.java +++ b/api/src/main/java/jakarta/faces/component/UIViewRoot.java @@ -221,6 +221,18 @@ public void addComponentResource(FacesContext context, UIComponent componentReso // https://issues.apache.org/jira/browse/MYFACES-2775 componentId = createUniqueId(context, null); componentResource.setId(componentId); + List children = componentResource.getChildren(); + + /* + * MYFACES-4631 + * Duplicate ID Exception can occur if children also aren't assigned unique IDs + * See https://github.com/primefaces-extensions/primefaces-extensions/issues/517 + */ + for(UIComponent child : children) { + String childId = createUniqueId(context, null); + child.setId(childId); + // TODO - Should we nest down further? + } } // This var helps to handle the case when we try to add a component that already is