[wizard] page.onExitingPage called incorrectly when using PREVIOUS/FINISH button

Issue #831 resolved
Dieter Vrancken
created an issue

The attached code contains a simple 3-page wizard with a Linear Flow. Each page prints a message both onEnteringPageandonExitingPage`. The output is unexpected. I assumed that every page was exited after it was entered and before any other page is entered.

Broken down according to user interaction the output is

  1. starting the application, as expected, we enter the first page

    entering first page
  2. pressing next, as expected, we exit the first page and enter the second page

    exiting first page 
    entering second page
  3. pressing next, as expected, we exit the second page and enter the third page

    exiting second page 
    entering third page
  4. pressing previous, it starts getting weird: even though we were on the first page, the first page got the onExitingPage call

    exiting first page 
    entering second page
  5. pressing previous, also weird: no onExitingPage call to any page

    entering first page

Looking at the Wizard code, we see that BUTTON_PREVIOUS_ACTION_HANDLER pops the previous page of the pageHistory to get the new currentPage. However updatePage uses that same pageHistory to figure out which page to send the onExitingPage call to.

It seems to me that it would be better to only set currentPage inside updatePage, with the new value supplied as a parameter. updatePage would then not have to look at the pageHistory at all as it can just use the old value of currentPage for exiting.

Comments (6)

  1. Eugene Ryzhikov

    The way to do it is actually to fork the repository, clone your fork and make your chnages. Once you push the changes to your fork, it will be possible to create a a pull request from your fork to the original repository

  2. Dieter Vrancken reporter

    I had done all those things, but still could not see the button to make a pull request. Turns out I needed to make the changes on a new branch, which took way too long to figure out. Perhaps this could be added to the contributor instructions?

    Anyway, please find the pull request here.

  3. Log in to comment