-
Bug
-
Resolution: Fixed
-
Critical
-
8.5.1, 8.5.2
-
Security Level: Jimmy
-
ZK 8.6.0 S1
-
None
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>