UI.close and Server Communication error Popup

I have some navigation code that will explicitly close a ui before navigating to another page. I do not wish to use

I’m doing:

UI.getCurrent().close();
Page.getCurrent().open(newURL, "");

This will intermittently throw a Communication problem issue because the client is trying to communicate to the closed UI. I’ve read the doc on UI.close mentions:


The UI is detached after the response is sent, so in the current request it can still update the client side normally. However, after the response any new requests from the client side to this UI will cause an error, so usually the client should be asked, for instance, to reload the page (serving a fresh UI instance), to close the page, or to navigate somewhere else.

What is the methodology I should be using to “navigate somewhere else”?

EDIT: Have been diving deeper. The Refresher addon is making a call client side. If the UI is closing, the browser will throw the Communication error. Is there something I can try to cleanup before calling ui.close? I’ve looked into detach listeners on the UI and removing the extension but that did not seem to work.

Hi,

This should be resolved in Vaadin 7.1.9 (tickets
12362
and
12298
). It prevents client-to-server communication if the client-side is stopped (either the UI closed or an error occurred).

Detach listeners are run too late (after the response is already sent). However, removing the refresher at the same time you call UI.close() should work.