From d7bbc512dbec68a0058d6f1f91d173c86d9a3344 Mon Sep 17 00:00:00 2001 From: Tatiana Elfimova Date: Wed, 11 Jun 2025 09:13:09 +0200 Subject: [PATCH] IJPL-188790 Search Everywhere: several scopes are shown as on the popup reopening - Only a few scopes are predefined and remain the same, the others differ with each call to scopesWithSeparators. GitOrigin-RevId: 730b43c38951ebbde9b49e882949132f829b5453 --- .../providers/target/SeTargetsProviderDelegate.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/searchEverywhere/backend/src/providers/target/SeTargetsProviderDelegate.kt b/platform/searchEverywhere/backend/src/providers/target/SeTargetsProviderDelegate.kt index 8f952026bacc..b27b71512f80 100644 --- a/platform/searchEverywhere/backend/src/providers/target/SeTargetsProviderDelegate.kt +++ b/platform/searchEverywhere/backend/src/providers/target/SeTargetsProviderDelegate.kt @@ -119,20 +119,24 @@ class SeTargetsProviderDelegate(private val contributorWrapper: SeAsyncWeightedC val all = mutableMapOf() val selectedScope = scopeChooserAction.selectedScope - var selectedScopeId: String? = null val scopeDataList = readAction { scopeChooserAction.scopesWithSeparators }.mapNotNull { scope -> val key = UUID.randomUUID().toString() - if (selectedScope.scopeEquals(scope.scope)) selectedScopeId = key - val data = SeSearchScopeData.from(scope, key) if (data != null) all[key] = scope data } - scopeIdToScope.store(all) + + val selectedScopeId = selectedScope.scope?.displayName.let { name -> + scopeDataList.firstOrNull { + @Suppress("HardCodedStringLiteral") + it.name == name + }?.scopeId + } + val everywhereScopeId = scopeChooserAction.everywhereScopeName?.let { name -> scopeDataList.firstOrNull { @Suppress("HardCodedStringLiteral")