Saturday, January 28, 2012

Re: Activity / Place + History.back()

So I solved my problem. We'd created a convience method that called
EventBus.fireEvent(new PlaceChangeEvent(Place)) instead of using the
PlaceController.goTo(Place). This was causing issues because even
though it felt the same it wasn't updating the "where" Place property
of the PlaceController so when History.back() was called it was
checking against a stale "where" object.

-Adam

On Jan 28, 12:44 pm, Adam <ambr...@gmail.com> wrote:
> I'm having an issue where the History.back() is intermittently not
> working.
>
> I'm using Places mapped to each activity in my application and
> navigating forward works great.
>
> For instance lets say we start out on "#search"->"#result".  If I
> programmatically use History.back() as a button in my application to
> return the the "#search" it occasionally does not load the #search
> page even though the url bar reflects the action.
>
> I've debugged the code and have tracked down where the problem is,
> just not 100% why.  The PlaceHistoryHandler class listens for
> ValueChangeEvent<String> from the browser which is fired when the
> History.back() is called.
> This in turn calls the PlaceHistoryHandler.handleHistoryToken(...)
> method which calls the PlaceController.goTo(Place) method.  THe
> PlaceController.goTo(Place) method is doing an if check if "where" ==
> "place" and if so returns without firing a PlaceChangeEvent.  That if
> check is causing the ActivityManager not to fire it's
> onPlaceChangeEvent, which in turns makes it so that the previous
> activity is not restarted for handling the "#search" place.
>
> As I said sometimes it works, sometimes it doesn't.  It's all based on
> the if check for "where == "place" though as to the outcome.  I know
> for a fact by staring at the url bar that there is a change.
>
> So is this a bug that others have see or am I doing something wrong?
>
> Any help would be appreciated.
>
> -Adam

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment