Re: How to use the JavaScriptDeferHeaderResponse correctly?
Hi Sven, Thank you for the workaround, I’ll try it out this week. I have also created a jira issue for this: https://issues.apache.org/jira/browse/WICKET-6953 Met vriendelijke groet, Kind regards, Bas Gooren Op 1 februari 2022 bij 20:22:58, Sven Meier (s...@meiers.net) schreef: As a workaround you could use this: getHeaderResponseDecorators().add( (response) -> { if (RequestCycle.get().find(AjaxRequestTarget.class) == null) { response = new JavaScriptDeferHeaderResponse(response); } return response; }); Regards Sven On 01.02.22 17:16, Sven Meier wrote: > Hi Bas, > > that seems to be broken since > https://issues.apache.org/jira/browse/WICKET-6703 > > The JS is correctly collected by PartialPageUpdate, but then sent > through the response decorators once again, thus being wrapped in a > 'DOMContentLoaded' listener. > > Please open a Jira issue. > > Regards > Sven > > > On 01.02.22 16:28, Sven Meier wrote: >> Hi Bas, >> >> your attachment didn't make it through the mailing list. >> >> Can you point me to where I can download it from? >> >> Thanks >> Sven >> >> >> On 31.01.22 14:51, Bas Gooren wrote: >>> Hi, >>> >>> We are experimenting with the JavaScriptDeferHeaderResponse, but out >>> of the box it doesn’t work correctly for us. >>> We are on wicket 9.7.0. >>> >>> On an Ajax call (e.g. link click), the response includes a >>> ‘DOMContentLoaded’ event listener (which is not needed there). Since >>> that never fires, any javascript handlers that are in the Ajax >>> response are not registered. >>> Please have a look at the attached Quickstart, which demonstrates >>> the issue. >>> >>> Once the AJAX link is clicked, this evaluate node is added to the >>> Ajax response (relevant part shown): >>> >>> document.addEventListener('DOMContentLoaded', function() { >>> (function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();; >>> }); >>> >>> The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded >>> event handler. >>> >>> I’m not sure if we should be using the JavaScriptDeferHeaderResponse >>> differently. We tried registering it using the three different >>> methods provided by the header response decorators collection (add, >>> add pre, add post). >>> >>> Any help would be appreciated :-) >>> >>> Met vriendelijke groet, >>> Kind regards, >>> >>> Bas Gooren >>> >>> - >>> To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail:users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to use the JavaScriptDeferHeaderResponse correctly?
As a workaround you could use this: getHeaderResponseDecorators().add( (response) -> { if (RequestCycle.get().find(AjaxRequestTarget.class) == null) { response = new JavaScriptDeferHeaderResponse(response); } return response; }); Regards Sven On 01.02.22 17:16, Sven Meier wrote: Hi Bas, that seems to be broken since https://issues.apache.org/jira/browse/WICKET-6703 The JS is correctly collected by PartialPageUpdate, but then sent through the response decorators once again, thus being wrapped in a 'DOMContentLoaded' listener. Please open a Jira issue. Regards Sven On 01.02.22 16:28, Sven Meier wrote: Hi Bas, your attachment didn't make it through the mailing list. Can you point me to where I can download it from? Thanks Sven On 31.01.22 14:51, Bas Gooren wrote: Hi, We are experimenting with the JavaScriptDeferHeaderResponse, but out of the box it doesn’t work correctly for us. We are on wicket 9.7.0. On an Ajax call (e.g. link click), the response includes a ‘DOMContentLoaded’ event listener (which is not needed there). Since that never fires, any javascript handlers that are in the Ajax response are not registered. Please have a look at the attached Quickstart, which demonstrates the issue. Once the AJAX link is clicked, this evaluate node is added to the Ajax response (relevant part shown): document.addEventListener('DOMContentLoaded', function() { (function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();; }); The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded event handler. I’m not sure if we should be using the JavaScriptDeferHeaderResponse differently. We tried registering it using the three different methods provided by the header response decorators collection (add, add pre, add post). Any help would be appreciated :-) Met vriendelijke groet, Kind regards, Bas Gooren - To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org For additional commands, e-mail:users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to use the JavaScriptDeferHeaderResponse correctly?
Hi Bas, that seems to be broken since https://issues.apache.org/jira/browse/WICKET-6703 The JS is correctly collected by PartialPageUpdate, but then sent through the response decorators once again, thus being wrapped in a 'DOMContentLoaded' listener. Please open a Jira issue. Regards Sven On 01.02.22 16:28, Sven Meier wrote: Hi Bas, your attachment didn't make it through the mailing list. Can you point me to where I can download it from? Thanks Sven On 31.01.22 14:51, Bas Gooren wrote: Hi, We are experimenting with the JavaScriptDeferHeaderResponse, but out of the box it doesn’t work correctly for us. We are on wicket 9.7.0. On an Ajax call (e.g. link click), the response includes a ‘DOMContentLoaded’ event listener (which is not needed there). Since that never fires, any javascript handlers that are in the Ajax response are not registered. Please have a look at the attached Quickstart, which demonstrates the issue. Once the AJAX link is clicked, this evaluate node is added to the Ajax response (relevant part shown): document.addEventListener('DOMContentLoaded', function() { (function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();; }); The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded event handler. I’m not sure if we should be using the JavaScriptDeferHeaderResponse differently. We tried registering it using the three different methods provided by the header response decorators collection (add, add pre, add post). Any help would be appreciated :-) Met vriendelijke groet, Kind regards, Bas Gooren - To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org For additional commands, e-mail:users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to use the JavaScriptDeferHeaderResponse correctly?
Hi Bas, your attachment didn't make it through the mailing list. Can you point me to where I can download it from? Thanks Sven On 31.01.22 14:51, Bas Gooren wrote: Hi, We are experimenting with the JavaScriptDeferHeaderResponse, but out of the box it doesn’t work correctly for us. We are on wicket 9.7.0. On an Ajax call (e.g. link click), the response includes a ‘DOMContentLoaded’ event listener (which is not needed there). Since that never fires, any javascript handlers that are in the Ajax response are not registered. Please have a look at the attached Quickstart, which demonstrates the issue. Once the AJAX link is clicked, this evaluate node is added to the Ajax response (relevant part shown): document.addEventListener('DOMContentLoaded', function() { (function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();; }); The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded event handler. I’m not sure if we should be using the JavaScriptDeferHeaderResponse differently. We tried registering it using the three different methods provided by the header response decorators collection (add, add pre, add post). Any help would be appreciated :-) Met vriendelijke groet, Kind regards, Bas Gooren - To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org For additional commands, e-mail:users-h...@wicket.apache.org
How to use the JavaScriptDeferHeaderResponse correctly?
Hi, We are experimenting with the JavaScriptDeferHeaderResponse, but out of the box it doesn’t work correctly for us. We are on wicket 9.7.0. On an Ajax call (e.g. link click), the response includes a ‘DOMContentLoaded’ event listener (which is not needed there). Since that never fires, any javascript handlers that are in the Ajax response are not registered. Please have a look at the attached Quickstart, which demonstrates the issue. Once the AJAX link is clicked, this evaluate node is added to the Ajax response (relevant part shown): document.addEventListener('DOMContentLoaded', function() { (function(){console.log('test');})();(function(){Wicket.Log.enabled=true;})();(function(){Wicket.Ajax.baseUrl="?0";})();(function(){Wicket.Ajax.ajax({"u":"./?0-1.0-ajax","c":"ajax1","e":"click","pd":true});})();(function(){console.log('click');})();; }); The Ajax handler (Wicket.Ajax.ajax()) is inside the DOMContentLoaded event handler. I’m not sure if we should be using the JavaScriptDeferHeaderResponse differently. We tried registering it using the three different methods provided by the header response decorators collection (add, add pre, add post). Any help would be appreciated :-) Met vriendelijke groet, Kind regards, Bas Gooren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org