1

In Vaadin 8, I am able to asynchronously update a Grid with incoming websocket data using the access method of UI, which locks the thread and performs the updates, then pushes them without the client having to request it.

access(() -> addMessage(message));

I am trying to use vaadin 10 now, and since the main class you start with doesn't extend UI, I am trying to do it like this:

UI.getCurrent().access((Command) () -> addTrade(message))

However it is not working, and you have to click somewhere on the page for the update to happen. I have the @Push annotation on the class, so I believe server push should work.. thank you so much guys!

in my servlet:

asyncSupported = true

have also tried this.getUI().get().access(), still not updating.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Nick Friskel
  • 2,369
  • 2
  • 20
  • 33

1 Answers1

2

This is most likely caused by https://github.com/vaadin/flow/issues/3256 that is currently being fixed.

The tickets also suggests a workaround: grid.getElement().getNode().markAsDirty();. If the workaround solves the issue, then it's very likely caused by that bug. If not, then there's some other issue that would require further investigation.

Leif Åstrand
  • 7,820
  • 13
  • 19
  • That was it, thank you so much! I did the `grid.getElement().getNode().markAsDirty();` right before calling refresh (inside the access method) – Nick Friskel Apr 06 '18 at 15:35