-
Bug
-
Resolution: Fixed
-
Normal
-
9.5.0.2
-
Security Level: Jimmy
-
None
Steps to Reproduce
manual example (also happens with Polling server push enabled - which sends 'dummy' requests automatically, just harder to debug)
<zk xmlns:w="client"> <button label="some event" onClick="Clients.log(event.toString())"/> <button label="send dummy" w:onClick="zAu.send(new zk.Event(this.desktop, 'dummy', null, {ignorable: true, rtags: {isDummy: true}}));"/> </zk>
1) open the network tab in the browser's dev tools
2) click the buttons -> observe the requests succeed
3) stop the server, disconnect the network
(or simulate in browser's dev tools network -> throttling -> offline)
4) click either button
A) some event
B) send dummy
5) restart the sever, reconnect network or disable offline
6A) click retry in dialog
7) click any button
Current Result
4) the network request fails (as expected when the server is no longer reachable)
4A) retry dialog is displayed (OK)
5) after restarting/reconnecting the server
6A) request is not retried, busy animation appears and never finishes
7) impossible ui is frozen
4B) nothing happens (OK)
5) after restarting/reconnecting
7) buttons stop sending events to the server (no events, no dummy requests)
Expected Result
after reconnecting/restarting the UI should continue to work (or if the session is gone, display a session timeout error)
This worked until ZK 9.1.0
Debug Information
related to moving from XHR to fetch()
The zAu.ajaxReq flag is not cleared in case of connection errors, preventing any new requests from being sent to the server.
Workaround
override the fetch function, and clear the zAu.ajaxReq flag in case of a connection failure (inside the catch block)
const origFetch = zAu._fetch; zAu._fetch = function(uri, opts) { return origFetch(uri, opts) .catch(error => { zAu.ajaxReq = zAu.ajaxReqInf = null; console.log('cleared zAu.ajaxReq, after connection error'); throw error; }); };//zAu._fetch