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

redirect + confirmClose = client engine stops

XMLWordPrintable

    • None

      Steps to Reproduce

      <zk>
      	<button label="confirm close" onClick='Clients.confirmClose("Please stay here")'/>
      	<button label="trigger redirect" onClick='execution.sendRedirect("");'/>
      	<button label="Test Server is still responding to AJAX" onClick="Clients.log(event.toString())"/>
      </zk>
      
      1. click "confirm close"
      2. click "trigger redirect"
      3. click cancel (stay on page don't reload)
      4. click button "Test Server ..."

      Current Result

      the button doesn't work anymore

      Expected Result

      when staying on the page the UI should continue working

      Debug Info

      after the redirect in the same browser tab the client engine is disabled an no more AU request are sent to the server

      Root Cause

      https://github.com/zkoss/zk/blob/v8.6.0/zk/src/archive/web/js/zk/au.js#L1221

      Workaround

      patch the redirect function to keep the au requests enabled:

      zk.afterMount(function() {
      	var redirectOrig = zAu.cmd0.redirect;
      	zAu.cmd0.redirect = function() {
      		redirectOrig.apply(this, arguments);
      		if(zk.confirmClose && zAu.disabledRequest) {
      			zAu.disabledRequest = false;
      		}
      	}
      });
      

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

              Created:
              Updated:
              Resolved: