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:
miruka 2021-04-13 16:00:03 -04:00
parent 3683d7db20
commit 8ea951957d

View File

@ -68,10 +68,8 @@ HLoader {
} }
function showPrevious(timesBack=1) { function showPrevious(timesBack=1) {
timesBack = Math.min(timesBack, history.length - 1) if (history.length < 2) return false
if (timesBack < 1) return false showNthFromHistory(Math.min(timesBack, history.length - 1))
showNthFromHistory(timesBack)
return true return true
} }