Fix PageLoader.showPrevious when history size < 2
If there was only one entry (the current page) in the page history, showPrevious() would just reload that page and not return false like supposed to when no history movement was done. When forgetting a room in those circumstances, this would also prevent the switch to the "secret default page" and just leave the user on a loading spinner for a room that didn't exist anymore.
This commit is contained in:
@@ -68,10 +68,8 @@ HLoader {
|
||||
}
|
||||
|
||||
function showPrevious(timesBack=1) {
|
||||
timesBack = Math.min(timesBack, history.length - 1)
|
||||
if (timesBack < 1) return false
|
||||
|
||||
showNthFromHistory(timesBack)
|
||||
if (history.length < 2) return false
|
||||
showNthFromHistory(Math.min(timesBack, history.length - 1))
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user