You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sebastian Frömel (Jira)" <ji...@apache.org> on 2021/02/25 14:52:00 UTC

[jira] [Created] (WICKET-6871) Exception with nexted AjaxLazyLoadPanel

Sebastian Frömel created WICKET-6871:
----------------------------------------

             Summary: Exception with nexted AjaxLazyLoadPanel
                 Key: WICKET-6871
                 URL: https://issues.apache.org/jira/browse/WICKET-6871
             Project: Wicket
          Issue Type: Bug
          Components: wicket-extensions
    Affects Versions: 9.2.0
            Reporter: Sebastian Frömel


Since our upgrade from wicket 6 to 9, we found the following bug:

If you nest a AjaxLazyLoadPanel you will get a
{code:java}
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
{code}
 

Here is portion of the code I used to verify the bug:

 
{code:java}
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");
			}

		});
	}
	
}
{code}
 
 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
  

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)