Window.close in access() thread and browser refresh issue

Hi,
I’ve successfully implemented vaadin push in portlet (https://vaadin.com/forum/thread/17075592) but I’m in stuck with ui refresh.

What we do is:

  1. Open a window with a loader
  2. Start a background thread with a web services request to my application server
  3. call access(() → { windowLoader.close(); }); to close the window when ws request ends.

The window doesn’t close until I resize browser window or do some stuff on client side and browser repaint ui (@Push is set to automatic mode).

I’ve tried adding: JavaScript.getCurrent().execute(“setTimeout(function () {$(window).trigger(‘resize’);},200)”); to force window resize by js but sometime works, sometime not…

Someone who had same issue?

The automatic mode of @Push, bundles push events with some heuristic. It works nicely say 99% of the time. However sometimes it may happen like in your case that push event is deferred (subjectively judged) and it happens later that you would want to. You can always do forced manual push also in automatic mode. That is good workaround to these corner cases.

UI.getCurrent().push();

I tried to force with push() but no way. The window stuck in place until I resize the browser window…

I can’t understand what it’s wrong… :frowning: