aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-08-23 12:24:56 +0100
committerStruan Donald <struan@exo.org.uk>2013-08-23 12:24:56 +0100
commit3f0eaa675e1dd90cf32fae78806da5b87203b0f5 (patch)
tree88f3a3e472f3f2969be5bb7db7d1e75d8a66e4de
parentdf59d3d5fc76ab39eb16712c3b7f2e4d91dd9288 (diff)
Fix race condition when setting currentView
As the front page only serves to work out what to do on load we should never set the currentView to front-page. However, due to execution order what actually happens is that the navigation to the front page completes after the navigation to the actual page displayed. This means that the incorrect currentView is set and the easiest way to fix is to prevent the currentView being set to the front page
-rw-r--r--src/js/router.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/js/router.js b/src/js/router.js
index 7398b00..6745835 100644
--- a/src/js/router.js
+++ b/src/js/router.js
@@ -169,8 +169,10 @@
$.mobile.changePage($(view.el), options);
- console.log('changed View to ' + view.id);
- this.currentView = view;
+ if ( view.id != 'front-page' ) {
+ console.log('changed View to ' + view.id);
+ this.currentView = view;
+ }
}
})
});