From c6b9a997f3626d1b86e96dc459baa8cb33d3643d Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 4 Nov 2022 11:34:55 +0000 Subject: [PATCH] make profile tab switch instant when the data is already available --- .../app/dapk/st/profile/ProfileViewModel.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileViewModel.kt b/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileViewModel.kt index bb3cfb6..ac5806c 100644 --- a/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileViewModel.kt +++ b/features/profile/src/main/kotlin/app/dapk/st/profile/ProfileViewModel.kt @@ -104,7 +104,23 @@ class ProfileViewModel( } fun reset() { - updateState { ProfileScreenState(SpiderPage(Page.Routes.profile, "Profile", null, Page.Profile(Lce.Loading()), hasToolbar = false)) } + when (state.page.state) { + is Page.Invitations -> updateState { + ProfileScreenState( + SpiderPage( + Page.Routes.profile, + "Profile", + null, + Page.Profile(Lce.Loading()), + hasToolbar = false + ) + ) + } + + is Page.Profile -> { + // do nothing + } + } } fun stop() {