I'm using History. Below is the code from my onModuleLoad(). I added the fireCurrentHistoryState() call as you suggested (thank you), but I'm having the same problem. After a refresh on a different page, I'm returned to the main page, where I click the same button. The click handler calls
History.newItem("Foo");
but my valueChangeHandler doesn't get invoked.
public void onModuleLoad() {
clientFactory = ClientFactoryImpl.getInstance();
// If the application starts with no history token, redirect to a new state.
String initToken = History.getToken();
if (initToken.length() == 0) {
History.newItem(MAIN);
}
History.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
String token = event.getValue();
handleHistoryToken(token);
}
});
History.fireCurrentHistoryState();
RootPanel.get().add(mainPanel);