ui.access() + ui.push() only work after user interacts with page

My code looks something like this:

ui.access(() -> {
  if (ui.getPushConfiguration().getPushMode() != PushMode.AUTOMATIC)

  // Do changes to the ui here


The code above gets executed in another thread and it succeds without problems, but the changes are only visible when the users interacts with the page (like clicking anywhere or pressing a key).
Shouldnt it be possible to see the changes without needing of user interaction?
I am on latest vaadin (23.2.0)

Have you added the annotation @Push?

Didnt know that was required


Ok I’ll try that gimme a sec

Ok found another workaround.
Added a listerner for ui init event and changed the pushmode to automatic there, instead of
doing it in the task itself!

thanks for the help anyways :wink:

You should read the documentation. If you add @Push you don’t have to call push yourself

Yeah I thought I would need to add @Push for each view

but if its only needed for the application class, im sold!

Hello guys ,

I have a question in vaadin 24 with the lattest Spring , So ui.access((Command) () → {
Notification.show("Hello ");
here only Notification.show(“Hello”) works, the test is button where doesnt work in other users and entityGrid is grid where also dont chage in other users , how to make it works ?

So are you calling that for all users? If so, and because Notification.show works, maybe you are mixing the references to the components :thinking: Make sure you are not for example making those components static. This sometimes happen for old desktop developers if they forget that this is multi-user environment.

Button test = new Button(“btn”);

its my view

UserListView.java (11.1 KB)

Thanks that helps. Works as coded :nerd_face: The Notification.show methods uses “thread local” variable and shows a notification for each UI separatly (the UI access call makes sure the UI.current() returns somewhat sane UI instance). But the test and entityGrid references are still pointing to those components in the UI of the user who is actually clicking.

You should probably make those components fields in the UserListView, make a method to that UserListView that modifies those, and save those instances instead of UIs, and then call that method. And then still remember to wrap the modification around UI access of that view.

Or check this example from our docs: Server Push | Advanced Topics | Vaadin Docs