What steps will reproduce the problem?
1. Load and Run Puzzlebazar
What is the expected output? What do you see instead?
When a user logs in or out of the application the
CurrentUserChangedEvent.fire(eventBus, result.getUser()); should fire only
once. At present it continues to fire according to a timer object in the
class. This means if you are using this event to perform say a setup of the
screen when a user first logs in, such as a go to Application Dashboard type
action then this will continue to happen throughout the lifetime of the
application.
What version of the product are you using? On what operating system?
GWTP v0.2, PuzzleBazar v0.2
Please provide any additional information below.
Fix is below in the onSuccess() and failed() methods the scheduleFetchUser
should not be re-setup as this re-initialises the timer.
{{{
/**
* Fetches the user information from the server. Fires a {@link CurrentUserChangedEvent} when successful.
*/
public void fetchUser() {
fetchUserTimer.cancel();
dispatcher.execute(new GetCurrentUserAction(), new AsyncCallback<GetUserResult>() {
@Override
public void onFailure(Throwable caught) {
confirmed = true; // Async call is back. We know if user is logged-in or not.
failed();
}
@Override
public void onSuccess(GetUserResult result) {
confirmed = true; // Async call is back. We know if user is logged-in or not.
if (result != null) {
user = result.getUser();
loginUrl = result.getLoginUrl();
logoutUrl = result.getLogoutUrl();
CurrentUserChangedEvent.fire(eventBus, result.getUser());
fetchUserTimer.cancel();
//scheduleFetchUser(refreshDelay);
} else {
failed();
}
}
private void failed() {
user = null; // Nobody is logged in
//scheduleFetchUser(retryDelay);
fetchUserTimer.cancel();
CurrentUserChangedEvent.fire(eventBus, null);
}
});
}
}}}
Original issue reported on code.google.com by drgenejones on 14 Jul 2010 at 4:40
Original issue reported on code.google.com by
drgenejones
on 14 Jul 2010 at 4:40