diff --git a/src/qml/Chat/Chat.qml b/src/qml/Chat/Chat.qml index f59d6263..d79e8902 100644 --- a/src/qml/Chat/Chat.qml +++ b/src/qml/Chat/Chat.qml @@ -21,7 +21,11 @@ HPage { onRoomInfoChanged: { if (roomInfo.left) { - // If left, the room will most likely be gone on client restart + // If left, the room will most likely be gone on client restart. + // Try to switch back to the previous page. + if (pageLoader.showPrevious()) return + + // If there wasn't any previous page, show default page. window.uiState.page = "Pages/Default.qml" window.uiState.pageProperties = {} window.uiStateChanged() diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 1d59e158..e6ef1122 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -134,7 +134,7 @@ Item { function showPrevious(timesBack=1) { timesBack = Math.min(timesBack, history.length - 1) - if (timesBack < 1) return + if (timesBack < 1) return false let [componentUrl, properties] = history[timesBack] @@ -143,6 +143,7 @@ Item { window.uiState.page = componentUrl window.uiState.pageProperties = properties window.uiStateChanged() + return true } onStatusChanged: if (status == Loader.Ready) {