Hi, On Tue, Jul 28, 2020 at 11:09 AM Zbynek Vavros <zbynekvav...@gmail.com> wrote:
> Hi, > > We have a page with AjaxSelfUpdatingTimerBehavior and now one of our > customers is complaining about "weird" behavior when this page is opened in > multiple browser tabs (yeah yeah we told him not to do it...). > > What happens is that after opening this page in new tab, the previous tab > gets ajax redirect on mentioned timer. > > After some digging I found out that this is happening because the page is > stateful. > Excerpt from Wicket code: > > // If the page is stateful then we cannot assume that the listener > interface is > // invoked on its initial state (right after page initialization) and that > its > // component and/or behavior will be available. That's why the listener > interface > // should be ignored and the best we can do is to re-paint the newly > constructed > // page. > > I did use StatelessChecker (very useful!) and found out that the reason is > this AjaxSelfUpdatingTimerBehavior. > > Googling around I found this thread from 2011 - > > http://apache-wicket.1842946.n4.nabble.com/Stateless-page-with-an-auto-update-section-td3795927.html > . > The suggestion here is to "roll your own timer behavior". > > Well, I spent some time with Wicket already but this is beyond my > knowledge. Can anyone please point me the right direction? Is this even > possible? I just have to say the AjaxSelfUpdatingTimerBehavior must stay - > this page displays progress bar of background task that is non-negotiable. > Try by overwriting AjaxSelfUpdatingTimerBehavior#getStatelessHint() and return true. Depending on how complex is your logic in #onTimer() it may work or not. See https://stackoverflow.com/a/10589807/497381 for more details. We integrated the Jolira's Wicket-Stateless approach in Wicket core since ver.7.4.0. > > Thanks, > Zbynek >