[ 
https://issues.apache.org/jira/browse/MYFACES-3739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13693033#comment-13693033
 ] 

Leonardo Uribe commented on MYFACES-3739:
-----------------------------------------

I have attached a working solution for this issue.

The idea is just store the inspected class in a component attribute, in cases 
where no PSS is used, or there is a programmatic addition, or 
refreshTransientBuild with preserveState option is used.

Later, on restore view phase, we can just inspect the facets that are used to 
store added resources and scan for this attribute. The idea is resfresh 
RequestViewContext, so the classes that has been already inspected by 
@ResourceDependency annotation will not be scanned anymore.

It has a very small hit in performance, but I consider this solution relevant 
because with JSF 2.2 vdl.createComponent(...) stuff there are more chances to 
found this problem again in the future. 

I have measured the size of a serialized class reference and is relatively 
small (80-150 bytes),

It could be good if someone can confirm if the attached patch works or not, so 
we can commit it and make it available on the next release.
                
> @ResourceDependency annotation + JSF 1.2 state saving + c:if (dynamic 
> section) creates components on each click (UIViewRoot grows)
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3739
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3739
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.1.12
>         Environment: myfaces 2.1.12
> Tomcat 6.0.36
>            Reporter: Andrei Zhemaituk
>         Attachments: MYFACES-3739-1.patch
>
>
> The issue was initially reported against RichFaces: 
> https://issues.jboss.org/browse/RF-13025
> But it does not look like it is anything wrong with RichFaces here.
> The issue is reproducible with pure myfaces when partial state saving is 
> turned OFF e.g. with the following code (every second click on "Toggle" 
> button causes new UIOutput element to be inserted to the view tree):
> {code}
>   <h:form>
>     <h:commandButton value="Toggle" action="#{bean.togglePanelShown}">
>       <f:ajax execute="@this" render="group"/>
>     </h:commandButton>
>     <h:panelGroup id="group">
>       <c:if test="#{bean.panelShown}">
>         <!-- Any component with @ResourceDependency annotation. -->
>         <custom:componentWithResourceDependency/>
>       </c:if>
>     </h:panelGroup>
>   </h:form>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to