ArcBees / GWTP

A complete model-view-presenter framework to simplify your next GWT project.
Other
334 stars 132 forks source link

PlaceManager Back Navigation fails when navigate back from SLOT Page #715

Open confile opened 9 years ago

confile commented 9 years ago

Note: I know that the SLOT notation changes but I keep the old and I assume the problem still exists.

Assume you have:

class PresenterA {

  @NameToken(NameTokens.tokenA)
  public interface MyProxy extends ProxyPlace<...> {
  }

  @ContentSlot
  public static final Type<BRevealContentHandler<?>> SLOT_MAIN = new Type<BRevealContentHandler<?>>();

}

PresenterA is a root presenter. Which is the first presenter you will reveal. Now you create a second presenter:

class PresenterB {

  @NameToken(NameTokens.tokenB)
  public interface MyProxy extends ProxyPlace<...> {
  }

  public PresenterB(...) {
   // reveal in PresenterA.SLOT_MAIN
  }
}

After you revealed PresenterA you navigate to PresenterB. So the view of PresenterA reveals the view of PresenterB.

Now, when you want to make:

placeManager.navigateBack()

of

    PlaceRequest request = new PlaceRequest.Builder()
      .nameToken(NameTokens.tokenA) 
      .build();
    placeManager.revealPlace(request); 

There will be no navigation. The reason is that PresenterA which is requested is still revealed. So nothing happens.

The correct thing which should happen is removeFromSlot with the view of PresenterB should be called on PresenterA's view.

confile commented 9 years ago

@christiangoudreau Could you please comment on this issue.

christiangoudreau commented 9 years ago

This is the normal behaviour, you should implement parent presenters as A containing B (empty) and C (with your stuff)

I'm keeping open this issue in case we find a solution once we rework the algorithm behind the scene for GWTP 2.0