Concurrency Problem when open window in DIALOG mode


I ran into a strange problem that I don’t know how to fix.
We built a reporting service that is pretty slow because of the amount of data we store and the complexity of the query (takes ±10 seconds to return).
When the user asks for a report, we call the appropriate service method in a background task and when the service returns, we open a window in WindowManager.OpenType.DIALOG with the files where the user can download them as bulk or one by one.
Now, in the meantime, the user can do whatever he wants in the application (do not have to wait until the export is ready) - if he does an action that opens a new window in WindowManager.OpenType.NEW_TAB right before the service returns, instead of opening the new window as a NEW_TAB and the reporting window as DIALOG, they are both opened as DIALOGs.

What do you think?


1 Like

I have this problem too.

I believe that what happens is that right before the user opens a new window (window2) with WindowManager.OpenType.NEW_TAB, the background task finishes and manages to open another window with WindowManager.OpenType.DIALOG (window1). Then, after window1 opens, the app must open window2. In this case, I think it will try to open it in a new tab relative to window1’s pop up window, but it fails so it falls back to opening window2 in another pop up that appears over window1.

This is a speculation, I’m not entirely sure.
Anyway, I’m sure it has to do with the fact that the page is server rendered and it must finish all the render commands that are in queue before displaying a “new version” of it, and it seems that in this case, the platform does not handle correctly this kind of concurrency.

Any help with this issue will be greatly appreciated. :sunny:


Could you please share test project or sample code? We definitely cannot help you without technical details. (341.5 KB)
This project reproduces exactly the issue that we are having.
To reproduce the issue click on the button inside screen 1 and you will see how screen 3 gets opened in a dialog mode too, even though I stated to open it in a new tab.


The answer is simple:

openWindow("screen-2", WindowManager.OpenType.DIALOG);
openWindow("screen-3", WindowManager.OpenType.NEW_TAB);

By design, you cannot open NEW_TAB dialog if there is a modal dialog on screen. If there is already modal dialog on screen all new windows are forced to be modal DIALOG.

Simply change the order of execution to:

openWindow("screen-3", WindowManager.OpenType.NEW_TAB);
openWindow("screen-2", WindowManager.OpenType.DIALOG);                

There is no concurrency problem here

1 Like

@codrin Generally speaking, it is bad UX forcing a DIALOG opening (whatever framework you use) disrupting the current user’s flow. The problem you describe can be reproduced in many other frameworks I used in the past.

A more robust solution is to display a notification when the background task has completed. Then you can extend the MainWindow, and add an icon/button on the menu bar (or sidebar) that when clicked opens the result dialog. You have various UX options here, like adding a badge indicating that there are N reports ready, or hide this control when there are no reports, the choice is yours.

Hope this helps.


Thanks guys.


By design, you cannot open NEW_TAB dialog if there is a modal dialog on screen. If there is already modal dialog on screen all new windows are forced to be modal DIALOG.

This was indeed our guess - so it has been confirmed now.

@pfurini - I think we’re gonna go for a notification section, thanks for the suggestions!