Avoid google map always init/render

Hi All,

is there a way to avoid google map always initialize when activate screen? (use cache maybe?) , because when we use application and move between screens frequently, the screen with google map triggering web browser crash,

Thanks in advance

Hello @arifian.prahata

I suggest you to enable MANAGED main TabSheet mode. In this mode screens are not unloaded and don’t re-render on opening. Pay attention that this feature decreases a time of screen opening, but increases memory cost.

To enable this option add the following config into the web-app.properties file:

cuba.web.mainTabSheetMode = MANAGED

Read more about this property in docs: link;



Hi, @tsarev thanks for your explanation,

Does this method can be applied on certain screen or all of the screens get impact ?


You can configure mode of managed TabSheet with the managedMainTabSheetMode property (docs) and then setup switch mode for the specific screen with the setContentSwitchMode(ContentSwitchMode mode) method: docs.


1 Like

Hi @tsarev thanks for information, very helpful :+1:

but I realize there is no clue how to give value for cuba.web.managedMainTabSheetMode, in document only mention default value HIDE_TABS, but how about other possible values?


and what does those values suppose to mean ?

This property can be found in WebConfig and you can realize that the ManagedMainTabSheetMode enum options are used as value for it.

This enum has two values:

  • HIDE_TABS - this option makes TabSheet hide screens with CSS rules and don’t unload them
  • UNLOAD_TABS - this option corresponds to default TabSheet behavior, which means that screens are unloaded while switching.

Hi Daniil,
By “increases memory cost”, how much memory increase? Depends on which aspects?


It is hard to say, because it fully depends on complexity of screens. It means that memory costs are directly proportional to components count.


It’s possible to set all tabs of a sheet as UNLOAD and only one as HIDE?

Hello @g.delogu

Yes, you can set UNLOAD_TABS for app property cuba.web.managedMainTabSheetMode to unload tabs by default. Then get Window reference by screen.getWindow(), and then use AbstractWindow#setContentSwitchMode method to setup required behavior.


I tried but it doesn’t work (cuba v6.10.15)

  • In web-app.properties i have:
cuba.web.mainTabSheetMode = MANAGED
cuba.web.managedMainTabSheetMode = UNLOAD_TABS
  • On the ready function of the Window i have:

But the window continue to reload on tab switch. If i set cuba.web.managedMainTabSheetMode = HIDE_TABS the window doesn’t reload at every switch, but obviously the other windows do the same.

Searching on the code i found in Window.java:

enum ContentSwitchMode {
     * Tab switching is determined by the managed main TabSheet mode (hide or unload content of a tab).
     * Tab content should be hidden not considering the TabSheet mode.
     * Tab content should be unloaded not considering the TabSheet mode.

The values are correct or they should be HIDE_TABS, UNLOAD_TABS?


Can you help?

Hi @g.delogu

I’ll check the case and give you an answer as soon as possible

I’ve checked the case and everything works nice.

In web-app.properties:

# managed main tabsheet mode
cuba.web.mainTabSheetMode = MANAGED
# unload tabs by default
cuba.web.managedMainTabSheetMode = UNLOAD_TABS

In screen controller:

public class TestScreen extends AbstractWindow {

    public void init(Map<String, Object> params) {



Demo project:

managed-tabsheet.zip (70.4 KB)


The problem was the call of “setContentSwitchMode(ContentSwitchMode.HIDE)” in the ready function. Moving in the init solved the problem