Wednesday, April 15, 2015

Re: pushstate - having trouble updating url without reloading page

As you're using Places, have a look at https://gist.github.com/tbroyer/1883821

On Wednesday, April 15, 2015 at 2:20:26 PM UTC+2, William Davis wrote:
I don't know if this makes a difference but I am still running GWT 2.5.1. Also while debugging I noticed that in PlaceHistoryHandler this handler is catching the url update:
historian.addValueChangeHandler(new ValueChangeHandler<String>() {
          public void onValueChange(ValueChangeEvent<String> event) {
            String token = event.getValue();
            handleHistoryToken(token);
          }
        });

It is my understanding that this handler should not think there is a value change when using pushstate. I verified again that in IE10 this value change is not being fired and the push state works fine, but in the latest IE, the change event is being executed. Pretty confused by this behavior. On a separate note I couldn't test in chrome today my dev mode plugin stopped working so all I have is IE and it's emulation.

IIRC, this is expected, but it's expected to produce the same Place that initiated the change (current value of PlaceController#getWhere), and when places compare equal then PlaceController#goTo just ignores the new place.
 

Thanks again,
Will

On Wednesday, April 15, 2015 at 7:41:20 AM UTC-4, William Davis wrote:
Jens,

I appreciate your quick reply, I am just getting around to trying your suggestion and unfortunately it is still reloading the page and going to a new place causing my UI to be rebuilt and the screen to flash which is undesirable. Thanks though.

Best,
Will

On Friday, April 10, 2015 at 1:57:17 PM UTC-4, Jens wrote:
In GWT source the pageUrl is created using

String pageUrl = link == null ? null : link.<String>prop("pathname");

and I would bet that its the same as calling window.location.pathname. In that case pathname always returns an absolute path starting with "/". So the GWT source would probably return a pageUrl that looks like "/?gwt.codesvr=127.0.0.1:9997#StandardView:parameter1&viewType=SomeSubView".

That's literally the only difference I see so you should try changing your code to 

String pageUrl = "/#StandardView:parameter1&viewType="+subView;


Maybe that helps to convince the other browsers :)


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment