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

race condition with dynamic widget loading/mounting

XMLWordPrintable

    • ZK 9.5.1 S1

      Steps to Reproduce

      run the attached example

      ./gradlew startJettyRunner
      

      http://localhost:8080/wpd-race/

      wait for components/widgets to be added/render dynamically via server push

      Current Result

      while components/widgets render as expected
      -> related wpd files are loaded on demand, when widgets are instantiated
      -> JS ERROR happens when a JS method is invoked on the 4th widget, too early

      zk.wpd:30474 Uncaught TypeError: Cannot read property 'apply' of undefined
          at Object.invoke (zk.wpd:30474)
          at doProcess (zk.wpd:28681)
          at zk.wpd:28643
          at Function.zk.afterMount (zk.wpd:26916)
          at dataNotReady (zk.wpd:28638)
          at doProcess (zk.wpd:28651)
          at doCmdsNow (zk.wpd:28780)
          at Object._doCmds (zk.wpd:29144)
          at mtAU0 (zk.wpd:27086)
          at doEnd (zk.wpd:26472)
      

       

      Expected Result

      no JS error, invoking JS on a component that's still being rendered should wait for it to become available

      Debug Information

      the example used a fixed delay to simulate network latency in zk.support.debug.MyWpdExtendlet

      This can be changed in zk.support.debug.WdpRaceComposer
      If too small the problem will occur less predictable.

      there are 2 ways to cause a problem (2nd commented out in the composer)

      1. Clients.response(new AuInvoke(component, "setStyle", "color: green;")); //causes client side error
      2. ((HtmlBasedComponent)test).setStyle("color: green"); //silently fails at client side

      Workaround

        1. screenshot-1.png
          17 kB
          cor3000

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: