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

Shadow Component ForEach adds fullfil listeners everytime the syncModel method is called, doesn't clear them if component is removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Normal Normal
    • None
    • 10.0.0, 9.6.4, 9.6.5
    • None
    • Security Level: Jimmy

      Steps to Reproduce

      Run attached fullfil.zul

      or run fiddle
      https://zkfiddle.org/sample/2qci0bo/1-repeating-fullfil-event-listeners

      Click "add dynamic item" 3 times

      click "clear model" once

      click "render all"

      Current Result

      onFullfill events trigger on the removed components.

      each component onFullfil is triggered (1 + number of syncModel called after being added) times 

      Expected Result

      onFullfill doesn't trigger for removed components

      onFullfill is called once per component which hold the listener

      Debug Information

      org.zkoss.zk.ui.impl.UiEngineImpl.TemplateImpl.create(Component, Component, VariableResolver, Composer) is called on each of the items currently in the model everytime org.zkoss.zuti.zul.ForEachListDataListener.onChange(ListDataEvent) is triggered by adding new elements in the model.

       

      This triggers org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(CreateInfo, NodeInfo, Component, Component) which adds new Fullfill listeners for every existing component, even those who already have a fullfill listener.

       

      Both issues should be solved by clearing fullfill listeners when the content of the shadow templates are destroyed and recreated during modelSync

      Workaround

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

              Created:
              Updated:
              Resolved: