[PR #6638] [MERGED] PM-33411: bug: Defer early navigation until lifecycle is resumed #32749

Closed
opened 2026-04-18 16:06:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6638
Author: @david-livefront
Created: 3/11/2026
Status: Merged
Merged: 3/11/2026
Merged by: @david-livefront

Base: mainHead: PM-33411-navigation-crash


📝 Commits (1)

  • 1a60e1b PM-33411: Defer early navigation until lifecycle is resumed

📊 Changes

9 files changed (+221 additions, -22 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt (+2 -2)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/search/SearchViewModel.kt (+1 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModel.kt (+2 -2)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModel.kt (+4 -4)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt (+1 -1)
📝 authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModel.kt (+2 -2)
📝 ui/src/main/kotlin/com/bitwarden/ui/platform/base/BackgroundEvent.kt (+9 -3)
📝 ui/src/main/kotlin/com/bitwarden/ui/platform/base/util/EventsEffect.kt (+26 -7)
ui/src/test/kotlin/com/bitwarden/ui/platform/base/util/EventsEffectTest.kt (+174 -0)

📄 Description

🎟️ Tracking

PM-33411

📔 Objective

This PR updates the EventsEffect to support deferred background events that will wait until the screen is resumed before firing the event. This us useful for events that are fired off during the init block of the VM.

This change should ensure that the graph is fully set on the NavHost before attempting to do a deeplink navigation. I believe this is the main place this sort of issue can occur because the navigation events are occurring at the same time the NavHost is being configured, leading to a race-condition.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6638 **Author:** [@david-livefront](https://github.com/david-livefront) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `PM-33411-navigation-crash` --- ### 📝 Commits (1) - [`1a60e1b`](https://github.com/bitwarden/android/commit/1a60e1bf56f1fda37a29d573d4756ade32185026) PM-33411: Defer early navigation until lifecycle is resumed ### 📊 Changes **9 files changed** (+221 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt` (+2 -2) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/search/SearchViewModel.kt` (+1 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModel.kt` (+2 -2) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModel.kt` (+4 -4) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt` (+1 -1) 📝 `authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockViewModel.kt` (+2 -2) 📝 `ui/src/main/kotlin/com/bitwarden/ui/platform/base/BackgroundEvent.kt` (+9 -3) 📝 `ui/src/main/kotlin/com/bitwarden/ui/platform/base/util/EventsEffect.kt` (+26 -7) ➕ `ui/src/test/kotlin/com/bitwarden/ui/platform/base/util/EventsEffectTest.kt` (+174 -0) </details> ### 📄 Description ## 🎟️ Tracking [PM-33411](https://bitwarden.atlassian.net/browse/PM-33411) ## 📔 Objective This PR updates the `EventsEffect` to support deferred background events that will wait until the screen is resumed before firing the event. This us useful for events that are fired off during the `init` block of the VM. This change should ensure that the graph is fully set on the `NavHost` before attempting to do a deeplink navigation. I believe this is the main place this sort of issue can occur because the navigation events are occurring at the same time the `NavHost` is being configured, leading to a race-condition. [PM-33411]: https://bitwarden.atlassian.net/browse/PM-33411?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-18 16:06:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#32749