From 2c9273a86ce7009c0391f574c290259987786b8c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 11 Nov 2015 02:00:51 +0100 Subject: [PATCH] avoid the initial sync from clobbering the location bar --- src/vector/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index 87cbd0b661..115d1de921 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -99,13 +99,15 @@ var lastLoadedScreen = null; // This will be called whenever the SDK changes screens, // so a web page can update the URL bar appropriately. -var onNewScreen = function(screen) { +var onNewScreen = function(screen, onlyIfBlank) { if (!loaded) { lastLoadedScreen = screen; } else { - var hash = '#/' + screen; - lastLocationHashSet = hash; - window.location.hash = hash; + if (!onlyIfBlank || !window.location.hash) { + var hash = '#/' + screen; + lastLocationHashSet = hash; + window.location.hash = hash; + } } }