Skip to content

Commit 191bfd9

Browse files
Merge pull request #386 from rdkcentral/router-backtrack-fix
Fixed router back track issue
2 parents b8f93bd + 420355f commit 191bfd9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/Router/index.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,8 @@ export const step = (level = 0) => {
357357
// for now we only support negative numbers
358358
level = Math.abs(level)
359359

360-
// we can't step back past the amount
361-
// of history entries
362-
if (level > history.length) {
363-
if (isFunction(app._handleAppClose)) {
364-
return app._handleAppClose()
365-
}
366-
return app.application.closeApp()
367-
} else if (history.length) {
360+
//Check whether we have any history avaialble or not
361+
if (history.length) {
368362
// for now we only support history back
369363
const route = history.splice(history.length - level, level)[0]
370364
// store changed history
@@ -395,6 +389,15 @@ export const step = (level = 0) => {
395389
}
396390
}
397391
}
392+
393+
// we can't step back past the amount
394+
// of history entries
395+
if (level > history.length) {
396+
if (isFunction(app._handleAppClose)) {
397+
return app._handleAppClose()
398+
}
399+
return app.application.closeApp()
400+
}
398401
return false
399402
}
400403

0 commit comments

Comments
 (0)