Tapestry
  1. Tapestry
  2. TAPESTRY-1155

Same event ID is generated for EventListener rendered within loop

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.1.1
    • Component/s: tapestry-core
    • Labels:
      None
    • Environment:
      Not environment related

      Description

      I have use the EventListener with the use of target while the target is rendered within a For. The script can generate multiple javascript with different clientId but the event ID are the same.

      ComponentEventConnectionWorker.getEvents function need to include the clientId during hash generation to prevent duplicated event ID for component. But I also found that this method is also called by renderBody method besides linkComponent. So I don't know whether the fix is adding a String as parameter for initial hash and pass target (renderBody) and clientId(linkComponent) to generate the initial hash value.

        Activity

        Hide
        Andy Yeung added a comment -

        Hi,
        I have tested with the latest snapshot and woks. Thank you.

        Show
        Andy Yeung added a comment - Hi, I have tested with the latest snapshot and woks. Thank you.
        Hide
        Andy Yeung added a comment -

        Hi, here is some more update on the issue. After changing the initial hash, the javascript is generated correctly, but the ComponentEventInvoker failed to work. In the invokeListeners method,

        // ensure only the method that targeted this event gets called!
        if (!eventListener.getComponentId().equals(event.getTarget().get("id"))
        continue;

        The getComponentId return the non unique name of the component while the event.getTarget().get("id") return the unique client id. Thus the listener failed to be triggered.
        My current workaround is to use

        if (!eventListener.getComponentId().equals(cycle.getParameter("component")))
        continue;

        Show
        Andy Yeung added a comment - Hi, here is some more update on the issue. After changing the initial hash, the javascript is generated correctly, but the ComponentEventInvoker failed to work. In the invokeListeners method, // ensure only the method that targeted this event gets called! if (!eventListener.getComponentId().equals(event.getTarget().get("id")) continue; The getComponentId return the non unique name of the component while the event.getTarget().get("id") return the unique client id. Thus the listener failed to be triggered. My current workaround is to use if (!eventListener.getComponentId().equals(cycle.getParameter("component"))) continue;

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Andy Yeung
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development