Skip to content

Conversation

@carloskelly13
Copy link
Contributor

@carloskelly13 carloskelly13 commented Nov 1, 2017

  • Adds support for out-of-order presenting via a goTo prop on <Slide />
  • Added unit tests for helper functions for calculating offsets and next unviewed slide index

I used a Set to track viewed indexes to ensure slides are only shown once. Indexes are removed when we navigate backwards so slides can be re-shown. A viewed index ordered set is necessary to prevent an infinite loop. For example, if Slide 2 directs to 4, and Slide 4 directs to 3, when we go forward from 3, we want to go to 5, otherwise we will be stuck in a loop of 4 to 2, 2 to 3 to 4.

Addresses #375

this._detachEvents();
}

viewedIndexes = new Set();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewedIndexes is just a property on the class because we don’t need to re-render the Manager when it changes. Therefore having it in state isn't necessary.

return this._nextUnviewedIndex();
}
return goTo - 1;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goToIndex() func prevents the infinite viewing loop. If we’ve already seen that out-of-order slide, let’s go to the next unviewed index.

@carloskelly13 carloskelly13 merged commit eaefcb5 into master Nov 1, 2017
@carloskelly13 carloskelly13 deleted the feature/out-of-order-routing branch November 1, 2017 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants