perf: avoid intermediate allocation in bottomNavKeys (#184)
Replaces `.map { ... }.toSet()` with `.mapTo(mutableSetOf()) { ... }`
when resolving `bottomNavKeys` to avoid creating and discarding an
intermediate `ArrayList` during recomposition.
This commit is contained in:
1 file changed
+1
-1
@@ -197,7 +197,7 @@ fun MainNavigation(sessionId: String? = null) {
|
||||
// recomposes and reflects choices instantly.
|
||||
val bottomNavItemsState by AuthManager.bottomNavItemsFlow.collectAsState()
|
||||
val bottomNavItems = resolveBottomNavItems(bottomNavItemsState)
|
||||
val bottomNavKeys = remember(bottomNavItems) { bottomNavItems.map { it.key }.toSet() }
|
||||
val bottomNavKeys = remember(bottomNavItems) { bottomNavItems.mapTo(mutableSetOf()) { it.key } }
|
||||
|
||||
// Sync primary screens to NavigationController
|
||||
LaunchedEffect(bottomNavKeys) {
|
||||
|
||||
Reference in new issue
Block a user