Push semi-working in v14

I have a strange issue where I do some work in a background thread and use a callback to update the UI. I have @Push on the root @Route component and the callback uses UI.access and finishes with a UI.push() for good measure but for some reason a Notification.show() turns up but e.g. an Label.setText doesn’t refresh.

How can the notification work but not the component update? Both are just changes to the DOM, right? Have I had too little coffee (or too much)?

Hmm. And now I get an “no UI instance available”. Which is strange since the update is being done within UI.access (UI instance stored away in view). However, if I refresh the browser, it works!

Yes, Notifications and component updates should be the same from the Push point of view. UI.push() shouldn’t be needed, either, unless you have explicitly set up manual push mode.

How are you getting the UI instance? Typically, it’s easiest to get it through a Component (or just a UI reference) you have passed on to the backing thread.

I pick up a UI.getCurrent() and store it in the view and do the UI.access through that. I’ve verified with UI.getUIId and eclipse debugger instance number that it’s the same one being used. There shouldn’t™ be any difference in passing along the actual instance all the way to the background thread vs e.g. accessing the same instance through a lambda?

Yes, that sounds like the right way to go.

And the browser refresh fixing it still sounds strange. If there would be a fundamental semantic thread-thingie it wouldn’t work

What if instead of storing the UI reference from UI.getCurent() in your view, you call view.getUI() instead?

Same thing. My view has @Push but if I put a

System.out.println(UI.getCurrent().getPushConfiguration().getPushMode()); in the view I get a

INFO [stdout]
(default task-191) DISABLED and after a browser refresh a
INFO [stdout]
(default task-191) AUTOMATIC

which is consistent with what I’m seeing

explicitly setting the PushMode to auto fixes my issues.

The plot thickens. If I go to my view by typing in the URL, @Push enables push but if I end up on my view through navigation, it’s disabled.

public class ViewA extends Div {

	public ViewA() {
		Button nav = new Button("navigate", e -> UI.getCurrent().navigate("test2"));
public class ViewB extends Div implements BeforeEnterObserver {

	public void beforeEnter(BeforeEnterEvent event) {


So you start on some View wihich doesn’t have @Push? Yes, that would explain why Push is not enabled.

Here’s a ticket that is describing the same issue, I think: https://github.com/vaadin/flow/issues/5759

Olli Tietäväinen:
Here’s a ticket that is describing the same issue, I think: https://github.com/vaadin/flow/issues/5759

Ah yes, must be the same issue. Fortunately there is an simple workaround