Out of Sync Error When Using The Same Session

I open IE with a simple Vaadin form. Then I hit Ctrl+N to open a new window with the same session.
Thing works as normal in the new window. But when I switch back to the old window, any submit will cause the “Out of Sync” error message.

Is this a bug? Is there any way to work around this issue?

It works as intended. When you return back to the first window, its state is no longer in sync with the server (in other words, there are have been changes on the server of which the client is not aware of), the client will detect this and show you an error message, as the client no longer knows what it should render. If you refresh the window, everything should work again as the UI is rendered from scratch according to the state stored on the server. Of course, having people refresh their browsers isn’t that user friendly :slight_smile:

As far as I know, you cannot have two windows open sharing one state. You can have open two different application sessions within the same browser - in other words, you can have two tabs open in IE, but both application instances will be separated from each other. To achieve this, you will have to override the getWindow method in the Application class. For more details, try searching the forums, it’s been discussed in multiple threads.

  • Kim

Thanks Kim,
I did find the documentation in the Application javadoc. So now I override the getWindow to return a new window instead.


Window w = super.getWindow(name);
        if (w == null) {
            // If no window found, create it
            w = new Window(name);
            // set windows name to the one requested
            w.setName(name);
            // add it to this application
            addWindow(w);
            // ensure use of window specific url
            w.open(new ExternalResource(w.getURL().toString()));
            // add some content
            w.addComponent(new Label("Test window"));
        }
        return w;

I have a question though: will keep adding the new window into the application instance will make it bloated with all new window lying around? Is there a way to discard the unused window?

Thanks