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

shadow <if> re-renders too eagerly

XMLWordPrintable

    • ZK 8.6.0 S1

      Steps to Reproduce

      run shadow-if-perf.zul
      click "notifyChange pojo.shown"

      Current Result

      the content of the <if> shadow element re-renders on notify change, even if the condition doesn't change

      Frequent unnecessary re-rendering of conditional content can lead to significant performance impact.

      Expected Result

      only remove/render the content when the condition changes

      Debug Info

      the replacement of the content can be observed by the updated component uuid and in the network response
      this behaved as expected up to 8.5.0

      Workaround

      Replace the <if> element with an <apply> and a dynamic template

      instead of:

      <if test="@load(vm.shown)">
          <div>
              <label value="${self.parent.toString()}"/>
          </div>
      </if>
      

      use:

      <apply template="@load(vm.shown ? 'shown' : null)">
          <template name="shown">
              <div>
                  <label value="${self.parent.toString()}"/>
              </div>
          </template>
      </apply>
      

      or shorter (using the implicit template named '' (empty string)):

      <apply template="@load(vm.shown ? '' : null)">
          <div>
              <label value="${self.parent.toString()}"/>
          </div>
      </apply>
      

            klyvechen klyvechen
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified Time Not Required
                Not Specified