Removing anchor in url closes the application window and repaints it.

Hi guys, I’m afraid that I’m back with my stories of application level windows and URI fragments.

Thanks to you, the previous problems have been fixed, i.e. home page display before any page on direct access:
http://vaadin.com/forum/-/message_boards/message/57240

I use Vaadin 6.1-pre2 (but I don’t think it has any influence).

We see another (less annoying) problem:

  1. From any page, as for example http://localhost:8080/MyApplication#screenName
  2. I remove the anchor from the URL in the browser and press enter: http://localhost:8080/MyApplication
  3. Request 1 is sent: /UIDL/windowName=MainWindow&onunloadburst=1
  4. Request 2 is sent: /
  5. Request 3 is sent: /UIDL/repaintAll=1&…
  6. Request 4 is sent: /UIDL /

On the browser, just after:
Request 2 → after that, browser display is empty
Request 3 → after that, start page is shown again (screenName)
Request 4 → after that, home page (expected target) is displayed

The problem is: the current page turned blank, then redisplayed, then only the target page (home page) apprears. I’d prefer that the home page appears directly.
From a “non-home” page to a “non-home” page, it works nicely, for example between:

In the debugger, I traced request 1 and it closes the MainWindow (current application level window).
Isn’t that the root of the problem?

  • AbstractApplicationServlet calls CommunicationManager.handleUidlRequest
  • It calls CommunicationManager.handleVariables
  • It detects a single variable: close = true with my MainWindow (application level window) instance as target.
  • Window.changeVariables is called
  • It detect the “close” variable and calls this.close().

I guess it causes the browser page to turn blank and the window to repaint itself. But I don’t really know in fact.

As a consequence (I guess), request 2 is fired and there, AbstractApplicationServlet calls writeAjaxPage method (with the following comment: // Send initial AJAX page that kickstarts a Vaadin application)

My question: is that an expected behaviour?

Many thanks.
John.

Did not look into problem closer, but my intuition is that removing # from URL forces browser to load the selected URL instead of seeking the achor within the existing page. Reloading sends close event (moving away from URL) to Application.

Your could test the above theory by moving between uri fragments and moving from /myapp/#foo to /myapp/# and compare how it differs from moving from /myapp/#foo to /myapp/

How to avoid this? I am not sure.

I think you are right, Joonas.

/myapp/#foo to /myapp/ problem
/myapp/#foo to /myapp/# works

It’s the same for the sampler:

http://demo.vaadin.com/sampler/#Components/Common/Tooltips
http://demo.vaadin.com/sampler/ ->>> redisplay tooltips before home page.

I’ve no more idea than you how to avoid it.
But I can already add # to home page intra-applications links.

Using /myapp/# as the “main url” of the app could be a good way of avoiding the issue. I do not know if there is a way to fix this in generic manner as /# → / causes page reload in the browser in any web page whether it uses Vaadin or not.