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:
M57 authored and GitHub committed 2026-06-20 23:42:40 +03:00
1 parent 3eb9e09f86
commit 34af34af6d
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) {