Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
9.2.0
-
None
Description
Since our upgrade from wicket 6 to 9, we found the following bug:
If you nest two (or more?) AjaxLazyLoadPanel you will get a
org.apache.wicket.WicketRuntimeException: Cannot replace a component which has not been added: id='content', component=[Component id = content]:
[AjaxLazyLoadPanel [Component id = innerPanel2]]
at org.apache.wicket.MarkupContainer.replace(MarkupContainer.java:849) ~[wicket-core-9.2.0.jar:9.2.0]
at org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel.isLoaded(AjaxLazyLoadPanel.java:214) ~[wicket-extensions-9.2.0.jar:9.2.0]
at org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel$AjaxLazyLoadTimer$1.component(AjaxLazyLoadPanel.java:260) ~[wicket-extensions-9.2.0.jar:9.2.0]
at org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel$AjaxLazyLoadTimer$1.component(AjaxLazyLoadPanel.java:256) ~[wicket-extensions-9.2.0.jar:9.2.0]
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144) ~[wicket-util-9.2.0.jar:9.2.0
Here is portion of the code I used to verify the bug:
public class TestPage extends BasePage { public TestPage() { add(new AjaxLazyLoadPanel<Panel>("panel1") { @Override public Panel getLazyLoadComponent(String markupId) { return new InnerPanel(markupId); } }); } } class InnerPanel extends Panel { /** * @param id */ public InnerPanel(String id) { super(id); add(new AjaxLazyLoadPanel<Label>("innerPanel2") { @Override public Label getLazyLoadComponent(String markupId) { return new Label(markupId, "later load text"); } }); } }
TestPage -> AjaxLazyLoadPanel -> InnerPanel -> AjaxLazyLoadPanel -> Label
After some investigation it looks like onConfigure() is not called on the inner AjaxLazyLoadPanel.
I know that is maybe makes no sense for the most use-cases of AjaxLazyLoadPanel to have nested panels, and we were able to remove one layer, but this is maybe something to consider anyway.
I could think of data which loaded within 2-5 seconds on the first panel and other data which could take 10 or more seconds on the more deeper panels.
But anyway, thanks for reading, and maybe this will find its way into a bugfix
Best,
Sebastian