Disabling UI while processing

I’m trying to implement a “disable UI while processing” feature for Vaadin 8 so that the user can’t go on a clicking rampage. I have something like


which technically works but it does a complete re-render of our custom components on return, resulting in loss of cursor focus. Is there some better way of doing this, perhaps somewhere closer to the Vaadin RPC communication so it wouldn’t have to be implemented in multiple places?

Another option I considered is spawning a separate thread and doing UI.access with some custom jquery-stuff that wouldn’t tickle the Vaadin lifecycle/re-render…