Why is the default for most components immediate=false?

I’m on my second application using Vaadin and find that I’m pretty much calling setImmediate(true) for every component I create for my user interface. On the surface, it seems ridiculous to be doing that explicitly 20 times on a 20-field panel. While I realize that not everyone needs events immediately, wouldn’t the majority of highly interactive apps? So shouldn’t that be the default for components? Either way, is there a way that I can set the default to “immediate” for all the components I create in my app?

Any suggestions are much appreciated.

As for example a TextField (or exactly AbstractField) , as soon as you add a listener it will automagically set the component to immediate :slight_smile:

Hi Jonas,
Thanks for that piece of knowledge. Is that also the case for NativeSelect or Table or Grid row selection events? Is there a page that lists “immediate” behavior for all components? Unless all the components go to “immediate” mode when a listener is added, my question still stands: is there a way to default to immediate mode for all components?

Thanks again for all info,

I don’t know the inner workings of Vaadin particularly well, but I have an enterprise-sized vaadin-app without a single row of setImmediate :slight_smile:

So my guess that you can just ignore that setImmediate until proven otherwise.

Yes, exactly like Jonas said, most often you shoudn’t need to call setImmediate anymore. I created that “magic” couple of years ago (don’t remember the exact version), but I have been really happy with the solution.

The default is false for a optimization reasons. This way less relevant changes are not causing XHRs, but only when a listener on the server side needs the state to be synchronized, the whole “change queue” is sent to the server in one batch. If you have a good network or websocket communication, this optimization is practically irrelevant.


Thanks guys! I removed a couple dozen “setImmediate()” after reading this without any ill effects :slight_smile: