emadalam / atvjs

Blazing fast Apple TV application development using pure JavaScript
https://emadalam.github.io/atvjs
MIT License
311 stars 49 forks source link

Replacing error pages #13

Closed hhumphrey-dazn closed 8 years ago

hhumphrey-dazn commented 8 years ago

Hi – great library, helped us a lot in setting up our tvOS app. But I believe I've come across a bug with the handling of error pages. The logic to detect whether to replace or push a document to the navigation stack is this, within the cleanNavigate method:

if (!replace && (!last || last !== loaderDoc || last !== errorDoc)) {

If the last doc was an errorDoc this returns true...as the last doc wasn't a loader doc. Therefore I believe it should be this:

if (!replace && (!last || ( last !== loaderDoc && last !== errorDoc ))) {

This will correctly fathom if the last doc was either an error or a loader, return false and proceed to replace the doc and not push.

If you are happy with this change I'll create a PR

emadalam commented 8 years ago

@hhumphrey-dazn @hhumphrey84 Thanks for the updates, much appreciated. Feel free to open more issues and feature requests 👍