2 Replies Latest reply on Aug 25, 2011 3:01 PM by Brian Leathem

    Is a4j too smart about not including duplicate javascript functions?

    Brian Leathem Master

      I've been looking into https://issues.jboss.org/browse/RF-10940


      It seems that there is some a4j optimization, whereby the definition of logically equivalent  ajax validator methods is suppressed.  You can see this in the .equals() method of the AjaxOnlyScript class:



      This works great, and seems like a great optimization.  The problem comes about when a component is re-rendered, at which point it's lost the reference to the shared function name.  It ends creating a reference to a non-existing function.  For now, I've suggested a work-around of including all ajax validated components within an a4j:panelGroup.


      As I see it, there are three ways out of this mess.

      1) Drop the optimization, and allow logically-duplicate methods to be defined

      2) Find some way of communicating the relevant method names back during the ajax call

      3) Use a reproducible hash of the function body for the function name - that way the reference to the function could be reproduced consistently


      To me, option 3 seems the easiest to implement, and the most robust, while maintaining the optimization.


      What do you guys think?