Skip to content

Commit b304503

Browse files
kfuledead-claudia
authored andcommitted
router: moves the lastUpdate reset logic to setPath(), fixes #2505
This ensures that the reset logic is executed even when there is an internal redirect to the default route in case of failure.
1 parent 152e5f0 commit b304503

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

api/router.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ module.exports = function($window, mountRedraw) {
139139
}
140140

141141
function setPath(path, data, options) {
142+
if (lastUpdate != null) {
143+
options = options || {}
144+
options.replace = true
145+
}
146+
lastUpdate = null
147+
142148
path = buildPathname(path, data)
143149
if (ready) {
144150
fireAsync()
@@ -181,14 +187,7 @@ module.exports = function($window, mountRedraw) {
181187
mountRedraw.mount(root, RouterRoot)
182188
resolveRoute()
183189
}
184-
route.set = function(path, data, options) {
185-
if (lastUpdate != null) {
186-
options = options || {}
187-
options.replace = true
188-
}
189-
lastUpdate = null
190-
setPath(path, data, options)
191-
}
190+
route.set = setPath
192191
route.get = function() {return currentPath}
193192
route.prefix = "#!"
194193
route.Link = {

0 commit comments

Comments
 (0)