Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-5014

UiEngineImpl.createComponents trigger page initiator after page init

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Normal
    • None
    • 9.6.0.1
    • None
    • None

    Description

      Steps to Reproduce

      Add initiator to zk.xml

       

      	<listener>
      	    <listener-class>foo.bar.ShadowPageInitiator</listener-class>
      	</listener>
      

       

      Run sample locally (attached files)

       

      Current Result

       These component creations trigger Initiator.doInit

      		<apply templateURI="template-inner.zul" content='@load("separate zul file as template")' />
      		<template name="myExtTemplate" src="template-inner.zul" />
      		<apply template="myExtTemplate" content='@load("external template")'>
      		</apply>
      		<button onClick="@command('doTheThing')"/>
      
      	@Command("doTheThing")
      	public void doTheThing() {
      		Executions.createComponents("template-inner.zul", Executions.getCurrent().getDesktop().getFirstPage().getFirstRoot(),null);
      	}
      

       These component creations do not trigger Initiator.doInit

      		<apply templateURI="template-inner.zul" content='@load("separate zul file as template")' />
      		<apply templateName="myTemplate" content='@load("inline content")'>
      			<div>
      				<label value="@load(content)"/>
      			</div>
      		</apply>
      

       

      Expected Result

      Intiator.doInit javadoc states:

      Note: when it is called, Page.getDesktop()Page.getId() and Page.getTitle() all return null, since the page is not initialized yet. 

       

      When initiator is triggered by createComponents, it receives a page that has already been instantiated.

      Debug Information

      CreateComponents create a dummy page to instantiate the components.

       Need to check if this is on spec.

      • Should CreateComponents call initiators on the dummy page?
      • Different apply structures have different results.

      Workaround

      To not trigger pre-init on initiator calls triggered by shadow element / createComponents calls, check for page UUID.

      If page UUID is not null, do not proceed with page init workflow

      Attachments

        1. template-inner.zul
          0.1 kB
        2. ShadowPageInitiator-1.java
          0.8 kB
        3. ShadowInitiatorViewModel-1.java
          0.3 kB
        4. shadow-initiator.zul
          0.6 kB

        Activity

          People

            Unassigned Unassigned
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: