Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

[Bug] Selected session is incorrect when opening from another app #2181

Closed
jonalmeida opened this issue Apr 30, 2019 · 5 comments
Closed

[Bug] Selected session is incorrect when opening from another app #2181

jonalmeida opened this issue Apr 30, 2019 · 5 comments
Labels
🐞 bug Crashes, Something isn't working, .. eng:health Improve code health eng:qa:verified QA Verified Feature:Tabs

Comments

@jonalmeida
Copy link
Contributor

jonalmeida commented Apr 30, 2019

Steps to reproduce

  1. Have a tab already open.
  2. Force close the app.
  3. Click a link from an external source.
  4. Observe the selected tab.

Expected behavior

  1. The link from the external source should be selected.

Actual behavior

  1. The previous selected tab is.

@csadilek and I investigated this issue and it seems to be occurring because of the async nature of the session restore which can sometimes be seen in to happen after the selected session was set by the IntentProcessor when an external tab is clicked.

The simplest solution would be to remove the coroutine and allow the updating to happen sequentially during the lazy initialization of the SessionManager.

This might have been added for performance reasons, so an alternative solution would be to hold on to the selected session, restore the state, and then re-set the selected session to it's prior one.

┆Issue is synchronized with this Jira Task

@jonalmeida jonalmeida added the 🐞 bug Crashes, Something isn't working, .. label Apr 30, 2019
@jonalmeida jonalmeida changed the title Selected session is incorrect when opening from another app [Bug] Selected session is incorrect when opening from another app Apr 30, 2019
@sblatz
Copy link
Contributor

sblatz commented Apr 30, 2019

Thank you for your investigation! 😄

@jonalmeida
Copy link
Contributor Author

jonalmeida commented Apr 30, 2019

Here is some sample code for the second solution:

diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt
index 3867fee..8f93858 100644
--- a/app/src/main/java/org/mozilla/fenix/components/Core.kt
+++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt
@@ -97,7 +97,11 @@ class Core(private val context: Context) {
                 // There's an active bundle with a snapshot: Feed it into the SessionManager.
                 snapshot.await()?.let {
                     try {
+                        val selected = sessionManager.selectedSession
                         sessionManager.restore(it)
+                        selected?.let {
+                            sessionManager.select(selected)
+                        }
                     } catch (_: IllegalArgumentException) {
                         return@let
                     }

@sv-ohorvath
Copy link
Contributor

Isn't this the same as #1279?

@vesta0
Copy link
Collaborator

vesta0 commented May 3, 2019

Yes it is @sv-ohorvath

@vesta0 vesta0 added this to the Bugs milestone May 3, 2019
@sv-ohorvath
Copy link
Contributor

verified this is fixed on the 5/6 build.
New issue: #2290

@sv-ohorvath sv-ohorvath added eng:qa:verified QA Verified and removed eng:qa:needed QA Needed labels May 6, 2019
@data-sync-user data-sync-user changed the title [Bug] Selected session is incorrect when opening from another app FNX2-17737 ⁃ [Bug] Selected session is incorrect when opening from another app Aug 5, 2020
@data-sync-user data-sync-user changed the title FNX2-17737 ⁃ [Bug] Selected session is incorrect when opening from another app FNX3-16123 ⁃ [Bug] Selected session is incorrect when opening from another app Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX3-16123 ⁃ [Bug] Selected session is incorrect when opening from another app FNX-5501 ⁃ [Bug] Selected session is incorrect when opening from another app Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-5501 ⁃ [Bug] Selected session is incorrect when opening from another app [Bug] Selected session is incorrect when opening from another app May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Crashes, Something isn't working, .. eng:health Improve code health eng:qa:verified QA Verified Feature:Tabs
Projects
None yet
Development

No branches or pull requests

7 participants